@sudosandwich/limps 1.0.1 → 1.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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ![Tests](https://img.shields.io/badge/Tests-692%20passing-brightgreen)
8
8
  ![Coverage](https://img.shields.io/badge/Coverage-%3E70%25-brightgreen)
9
9
 
10
- ![limps in action](https://github.com/paulbreuler/limps/blob/74b6d35d1e209f7b620fb23c4f3f1e261e1daff8/.github/assets/limps-in-action.gif)
10
+ ![limps in action](https://github.com/paulbreuler/limps/blob/main/.github/assets/limps-in-action.gif?raw=true)
11
11
 
12
12
  *Claude Desktop accessing the planning MCP, talking to Runi project docs*
13
13
 
package/dist/cli.js CHANGED
@@ -1,9 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  import Pastel from 'pastel';
3
+ import updateNotifier from 'update-notifier';
4
+ import { getPackageVersion, getPackageName } from './utils/version.js';
5
+ // Initialize update notifier for automatic update checks
6
+ // This runs asynchronously in the background and won't block CLI startup
7
+ const pkg = {
8
+ name: getPackageName(),
9
+ version: getPackageVersion(),
10
+ };
11
+ updateNotifier({
12
+ pkg,
13
+ updateCheckInterval: 1000 * 60 * 60 * 24 * 7, // Check once per week
14
+ }).notify();
3
15
  const app = new Pastel({
4
16
  importMeta: import.meta,
5
17
  name: 'limps',
6
- version: '0.3.0',
18
+ version: getPackageVersion(),
7
19
  description: 'Local Intelligent MCP Planning Server',
8
20
  });
9
21
  await app.run();
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,IAAI;IACvB,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,uCAAuC;CACrD,CAAC,CAAC;AAEH,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEvE,yDAAyD;AACzD,yEAAyE;AACzE,MAAM,GAAG,GAAG;IACV,IAAI,EAAE,cAAc,EAAE;IACtB,OAAO,EAAE,iBAAiB,EAAE;CAC7B,CAAC;AAEF,cAAc,CAAC;IACb,GAAG;IACH,mBAAmB,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,sBAAsB;CACrE,CAAC,CAAC,MAAM,EAAE,CAAC;AAEZ,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,IAAI;IACvB,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,iBAAiB,EAAE;IAC5B,WAAW,EAAE,uCAAuC;CACrD,CAAC,CAAC;AAEH,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,0CAA0C,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,KAAK,CAAC,SAAS,CAwBxD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,0CAA0C,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,KAAK,CAAC,SAAS,CA0BxD"}
@@ -1,7 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Text } from 'ink';
3
+ import { getPackageVersion } from '../utils/version.js';
3
4
  export const description = 'Local Intelligent MCP Planning Server';
4
5
  export default function DefaultCommand() {
5
- return (_jsxs(Text, { children: [_jsx(Text, { color: "cyan", bold: true, children: "limps" }), ' ', "- Local Intelligent MCP Planning Server", '\n', '\n', _jsx(Text, { color: "yellow", children: "Usage:" }), " limps ", '<command>', " [options]", '\n', '\n', _jsx(Text, { color: "cyan", children: "Commands:" }), '\n', ' ', "serve", ' ', "Start the MCP server", '\n', ' ', "init ", '<name> ', "Initialize a new project", '\n', ' ', "list-plans", ' ', "List all plans with status", '\n', ' ', "list-agents", ' ', "List agents in a plan", '\n', ' ', "next-task", ' ', "Get the next best task", '\n', ' ', "status", ' ', "Show plan progress", '\n', ' ', "config", ' ', "Manage project configuration", '\n', '\n', "Run ", _jsxs(Text, { color: "green", children: ["limps ", '<command>'] }), " without args for usage help.", '\n', "Run ", _jsxs(Text, { color: "green", children: ["limps ", '<command>', " --help"] }), " for full documentation."] }));
6
+ const version = getPackageVersion();
7
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "cyan", bold: true, children: "limps" }), ' ', _jsxs(Text, { color: "yellow", children: ["v", version] }), " - Local Intelligent MCP Planning Server", '\n', '\n', _jsx(Text, { color: "yellow", children: "Usage:" }), " limps ", '<command>', " [options]", '\n', '\n', _jsx(Text, { color: "cyan", children: "Commands:" }), '\n', ' ', "serve", ' ', "Start the MCP server", '\n', ' ', "init ", '<name> ', "Initialize a new project", '\n', ' ', "list-plans", ' ', "List all plans with status", '\n', ' ', "list-agents", ' ', "List agents in a plan", '\n', ' ', "next-task", ' ', "Get the next best task", '\n', ' ', "status", ' ', "Show plan progress", '\n', ' ', "version", ' ', "Show version information", '\n', ' ', "config", ' ', "Manage project configuration", '\n', '\n', "Run ", _jsxs(Text, { color: "green", children: ["limps ", '<command>'] }), " without args for usage help.", '\n', "Run ", _jsxs(Text, { color: "green", children: ["limps ", '<command>', " --help"] }), " for full documentation."] }));
6
8
  }
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,MAAM,CAAC,MAAM,WAAW,GAAG,uCAAuC,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,cAAc;IACpC,OAAO,CACL,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,IAAI,4BAEhB,EAAC,GAAG,6CAC6B,IAAI,EAC3C,IAAI,EACL,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,uBAAc,aAAQ,WAAW,gBAAY,IAAI,EACpE,IAAI,EACL,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,0BAAiB,EAClC,IAAI,EACJ,IAAI,WAAO,WAAW,0BAAsB,IAAI,EAChD,IAAI,WAAO,WAAW,8BAA0B,IAAI,EACpD,IAAI,gBAAY,MAAM,gCAA4B,IAAI,EACtD,IAAI,iBAAa,KAAK,2BAAuB,IAAI,EACjD,IAAI,eAAW,OAAO,4BAAwB,IAAI,EAClD,IAAI,YAAQ,UAAU,wBAAoB,IAAI,EAC9C,IAAI,YAAQ,UAAU,kCAA8B,IAAI,EACxD,IAAI,UACD,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,uBAAQ,WAAW,IAAQ,mCAA8B,IAAI,UAChF,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,uBAAQ,WAAW,eAAe,gCACpD,CACR,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,CAAC,MAAM,WAAW,GAAG,uCAAuC,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,cAAc;IACpC,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,OAAO,CACL,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,IAAI,4BAEhB,EAAC,GAAG,EACX,MAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,kBAAG,OAAO,IAAQ,8CAAyC,IAAI,EAClF,IAAI,EACL,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,uBAAc,aAAQ,WAAW,gBAAY,IAAI,EACpE,IAAI,EACL,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,0BAAiB,EAClC,IAAI,EACJ,IAAI,WAAO,WAAW,0BAAsB,IAAI,EAChD,IAAI,WAAO,WAAW,8BAA0B,IAAI,EACpD,IAAI,gBAAY,MAAM,gCAA4B,IAAI,EACtD,IAAI,iBAAa,KAAK,2BAAuB,IAAI,EACjD,IAAI,eAAW,OAAO,4BAAwB,IAAI,EAClD,IAAI,YAAQ,UAAU,wBAAoB,IAAI,EAC9C,IAAI,aAAS,UAAU,8BAA0B,IAAI,EACrD,IAAI,YAAQ,UAAU,kCAA8B,IAAI,EACxD,IAAI,UACD,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,uBAAQ,WAAW,IAAQ,mCAA8B,IAAI,UAChF,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,uBAAQ,WAAW,eAAe,gCACpD,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export declare const description = "Show version information";
3
+ export declare const options: z.ZodObject<{
4
+ check: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
5
+ }, z.core.$strip>;
6
+ interface Props {
7
+ options: z.infer<typeof options>;
8
+ }
9
+ export default function VersionCommand({ options }: Props): React.ReactNode;
10
+ export {};
11
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/commands/version.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW,6BAA6B,CAAC;AAEtD,eAAO,MAAM,OAAO;;iBAElB,CAAC;AAEH,UAAU,KAAK;IACb,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAgG1E"}
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text } from 'ink';
3
+ import { z } from 'zod';
4
+ import { useEffect, useState } from 'react';
5
+ import { getPackageVersion, getPackageName } from '../utils/version.js';
6
+ export const description = 'Show version information';
7
+ export const options = z.object({
8
+ check: z.boolean().optional().default(false).describe('Check for updates from npm registry'),
9
+ });
10
+ export default function VersionCommand({ options }) {
11
+ const currentVersion = getPackageVersion();
12
+ const packageName = getPackageName();
13
+ const [updateInfo, setUpdateInfo] = useState(null);
14
+ const [isChecking, setIsChecking] = useState(false);
15
+ useEffect(() => {
16
+ if (options.check) {
17
+ setIsChecking(true);
18
+ // For manual checks, fetch directly from npm registry
19
+ fetch(`https://registry.npmjs.org/${packageName}/latest`)
20
+ .then((response) => {
21
+ if (!response.ok) {
22
+ throw new Error(`HTTP ${response.status}`);
23
+ }
24
+ return response.json();
25
+ })
26
+ .then((data) => {
27
+ const pkgData = data;
28
+ const latestVersion = pkgData.version;
29
+ if (latestVersion !== currentVersion) {
30
+ setUpdateInfo({
31
+ latest: latestVersion,
32
+ current: currentVersion,
33
+ });
34
+ }
35
+ else {
36
+ setUpdateInfo({
37
+ current: currentVersion,
38
+ });
39
+ }
40
+ setIsChecking(false);
41
+ })
42
+ .catch((error) => {
43
+ setUpdateInfo({
44
+ current: currentVersion,
45
+ error: error instanceof Error ? error.message : 'Unknown error',
46
+ });
47
+ setIsChecking(false);
48
+ });
49
+ }
50
+ }, [options.check, currentVersion, packageName]);
51
+ if (options.check) {
52
+ if (isChecking) {
53
+ return (_jsx(Text, { children: _jsx(Text, { color: "cyan", children: "Checking for updates..." }) }));
54
+ }
55
+ if (updateInfo?.error) {
56
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "yellow", children: "Version:" }), " ", updateInfo.current, '\n', _jsx(Text, { color: "red", children: "Error checking for updates:" }), " ", updateInfo.error] }));
57
+ }
58
+ if (updateInfo?.latest && updateInfo.latest !== updateInfo.current) {
59
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "yellow", children: "Current version:" }), " ", updateInfo.current, '\n', _jsx(Text, { color: "green", children: "Latest version:" }), " ", updateInfo.latest, '\n\n', _jsx(Text, { color: "cyan", children: "Update available!" }), '\n', "Run: ", _jsxs(Text, { color: "green", children: ["npm update -g ", packageName] })] }));
60
+ }
61
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "yellow", children: "Version:" }), " ", updateInfo?.current || currentVersion, '\n', _jsx(Text, { color: "green", children: "You are up to date!" })] }));
62
+ }
63
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "cyan", bold: true, children: packageName }), ' ', _jsx(Text, { color: "yellow", children: currentVersion })] }));
64
+ }
65
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/commands/version.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,CAAC,MAAM,WAAW,GAAG,0BAA0B,CAAC;AAEtD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,KAA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O,+BAAgB,WAAW,IAAQ,IACtD,CACR,CAAC;QACJ,CAAC;QAED,OAAO,CACL,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,yBAAgB,OAAE,UAAU,EAAE,OAAO,IAAI,cAAc,EAC1E,IAAI,EACL,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,oCAA2B,IACzC,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,IAAI,kBACpB,WAAW,GACP,EAAC,GAAG,EACX,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,YAAE,cAAc,GAAQ,IACvC,CACR,CAAC;AACJ,CAAC"}
package/dist/index.js CHANGED
File without changes
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Version utilities for reading package.json information.
3
+ */
4
+ /**
5
+ * Get the current package version from package.json.
6
+ *
7
+ * @returns The version string (e.g., "1.0.2")
8
+ */
9
+ export declare function getPackageVersion(): string;
10
+ /**
11
+ * Get the package name from package.json.
12
+ *
13
+ * @returns The package name (e.g., "@sudosandwich/limps")
14
+ */
15
+ export declare function getPackageName(): string;
16
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AAyBH;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAG1C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAGvC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Version utilities for reading package.json information.
3
+ */
4
+ import { readFileSync } from 'fs';
5
+ import { join, dirname } from 'path';
6
+ import { fileURLToPath } from 'url';
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+ /**
10
+ * Get the path to package.json relative to this module.
11
+ */
12
+ function getPackageJsonPath() {
13
+ return join(__dirname, '..', '..', 'package.json');
14
+ }
15
+ /**
16
+ * Read and parse package.json.
17
+ */
18
+ function readPackageJson() {
19
+ const packageJsonPath = getPackageJsonPath();
20
+ const content = readFileSync(packageJsonPath, 'utf-8');
21
+ return JSON.parse(content);
22
+ }
23
+ /**
24
+ * Get the current package version from package.json.
25
+ *
26
+ * @returns The version string (e.g., "1.0.2")
27
+ */
28
+ export function getPackageVersion() {
29
+ const pkg = readPackageJson();
30
+ return pkg.version;
31
+ }
32
+ /**
33
+ * Get the package name from package.json.
34
+ *
35
+ * @returns The package name (e.g., "@sudosandwich/limps")
36
+ */
37
+ export function getPackageName() {
38
+ const pkg = readPackageJson();
39
+ return pkg.name;
40
+ }
41
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC;;GAEG;AACH,SAAS,kBAAkB;IACzB,OAAO,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,SAAS,eAAe;IACtB,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;IAC7C,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;IAC9B,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudosandwich/limps",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Local Intelligent MCP Planning Server - AI agent plan management and coordination",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -51,16 +51,17 @@
51
51
  ],
52
52
  "dependencies": {
53
53
  "@modelcontextprotocol/sdk": "^1.22.0",
54
- "better-sqlite3": "^11.7.0",
55
- "chokidar": "^4.0.3",
54
+ "better-sqlite3": "^12.6.2",
55
+ "chokidar": "^5.0.0",
56
56
  "ink": "^6.6.0",
57
57
  "micromatch": "^4.0.8",
58
- "open": "^10.2.0",
58
+ "open": "^11.0.0",
59
59
  "pastel": "^4.0.0",
60
60
  "quickjs-emscripten": "^0.31.0",
61
61
  "react": "^19.2.3",
62
62
  "remove-markdown": "^0.6.3",
63
- "which": "^4.0.0",
63
+ "update-notifier": "^7.3.1",
64
+ "which": "^6.0.0",
64
65
  "yaml": "^2.7.0",
65
66
  "zod": "^4.3.6"
66
67
  },
@@ -80,17 +81,18 @@
80
81
  "@eslint/js": "^9.39.2",
81
82
  "@types/better-sqlite3": "^7.6.12",
82
83
  "@types/micromatch": "^4.0.10",
83
- "@types/node": "^25.0.9",
84
+ "@types/node": "^25.0.10",
84
85
  "@types/react": "^19.2.9",
86
+ "@types/update-notifier": "^6.0.8",
85
87
  "@types/which": "^3.0.4",
86
- "@vitest/coverage-v8": "^4.0.17",
88
+ "@vitest/coverage-v8": "^4.0.18",
87
89
  "eslint": "^9.39.2",
88
90
  "husky": "^9.1.7",
89
91
  "ink-testing-library": "^4.0.0",
90
92
  "lint-staged": "^16.2.7",
91
- "prettier": "^3.8.0",
93
+ "prettier": "^3.8.1",
92
94
  "typescript": "^5.9.3",
93
95
  "typescript-eslint": "^8.53.1",
94
- "vitest": "^4.0.17"
96
+ "vitest": "^4.0.18"
95
97
  }
96
98
  }
@@ -1,38 +0,0 @@
1
- /**
2
- * read_doc tool: Read full content of any document in the repository.
3
- */
4
- import { z } from 'zod';
5
- import type { ToolContext, ToolResult } from '../types.js';
6
- /**
7
- * Input schema for read_doc tool.
8
- */
9
- export declare const ReadDocInputSchema: z.ZodObject<{
10
- path: z.ZodString;
11
- lines: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
12
- }, z.core.$strip>;
13
- export type ReadDocInput = z.infer<typeof ReadDocInputSchema>;
14
- /**
15
- * Output interface for read_doc tool.
16
- */
17
- export interface ReadDocOutput {
18
- path: string;
19
- content: string;
20
- metadata: {
21
- size: number;
22
- lines: number;
23
- modified: string;
24
- type: 'md' | 'jsx' | 'tsx' | 'ts' | 'json' | 'yaml' | 'other';
25
- partial?: boolean;
26
- range?: [number, number];
27
- };
28
- }
29
- /**
30
- * Handle read_doc tool request.
31
- * Reads full file content with optional line range.
32
- *
33
- * @param input - Tool input
34
- * @param context - Tool context
35
- * @returns Tool result
36
- */
37
- export declare function handleReadDoc(input: ReadDocInput, context: ToolContext): Promise<ToolResult>;
38
- //# sourceMappingURL=read-doc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read-doc.d.ts","sourceRoot":"","sources":["../../src/tools/read-doc.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI3D;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;iBAM7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;QAC9D,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC1B,CAAC;CACH;AAeD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAuJrB"}
@@ -1,174 +0,0 @@
1
- /**
2
- * read_doc tool: Read full content of any document in the repository.
3
- */
4
- import { z } from 'zod';
5
- import { readFile, stat } from 'fs/promises';
6
- import { existsSync } from 'fs';
7
- import { dirname } from 'path';
8
- import { validatePath } from '../utils/paths.js';
9
- import { notFound } from '../utils/errors.js';
10
- /**
11
- * Input schema for read_doc tool.
12
- */
13
- export const ReadDocInputSchema = z.object({
14
- path: z.string().min(1).describe('Path relative to repo root'),
15
- lines: z
16
- .tuple([z.number().int().positive(), z.number().int().positive()])
17
- .optional()
18
- .describe('Optional line range [start, end], 1-indexed'),
19
- });
20
- /**
21
- * Get repository root from config.
22
- * Uses the first docsPath entry as the repo root, or derives from plansPath.
23
- */
24
- function getRepoRoot(config) {
25
- // Prefer docsPaths[0] if it exists (it's the repo root)
26
- if (config.docsPaths && config.docsPaths.length > 0) {
27
- return config.docsPaths[0];
28
- }
29
- // Fallback: use plansPath parent directory
30
- return dirname(config.plansPath);
31
- }
32
- /**
33
- * Handle read_doc tool request.
34
- * Reads full file content with optional line range.
35
- *
36
- * @param input - Tool input
37
- * @param context - Tool context
38
- * @returns Tool result
39
- */
40
- export async function handleReadDoc(input, context) {
41
- const { path, lines } = input;
42
- const { config } = context;
43
- try {
44
- // Get repo root
45
- const repoRoot = getRepoRoot(config);
46
- // Validate path first
47
- const validated = validatePath(path, repoRoot);
48
- // Check if file exists
49
- if (!existsSync(validated.absolute)) {
50
- throw notFound(path);
51
- }
52
- // Read file stats
53
- const stats = await stat(validated.absolute);
54
- // Read file content
55
- const content = await readFile(validated.absolute, 'utf-8');
56
- // Count lines (empty file has 0 lines, not 1)
57
- const lineCount = content === '' ? 0 : content.split('\n').length;
58
- // Handle line range if specified
59
- let finalContent = content;
60
- let partial = false;
61
- let range;
62
- if (lines) {
63
- const [start, end] = lines;
64
- // Validate range
65
- if (start > end) {
66
- return {
67
- content: [
68
- {
69
- type: 'text',
70
- text: `Invalid line range: start (${start}) must be <= end (${end})`,
71
- },
72
- ],
73
- isError: true,
74
- };
75
- }
76
- if (start < 1 || end < 1) {
77
- return {
78
- content: [
79
- {
80
- type: 'text',
81
- text: `Invalid line range: line numbers must be >= 1`,
82
- },
83
- ],
84
- isError: true,
85
- };
86
- }
87
- // Convert 1-indexed to 0-indexed
88
- const startIdx = start - 1;
89
- const endIdx = end; // end is inclusive, so we use it directly for slice
90
- // Split into lines
91
- const contentLines = content.split('\n');
92
- // Validate range against file
93
- if (startIdx > contentLines.length) {
94
- return {
95
- content: [
96
- {
97
- type: 'text',
98
- text: `Line range [${start}, ${end}] exceeds file length (${lineCount} lines)`,
99
- },
100
- ],
101
- isError: true,
102
- };
103
- }
104
- // Extract range (endIdx is exclusive in slice, so we add 1)
105
- const endSlice = Math.min(endIdx, contentLines.length);
106
- const selectedLines = contentLines.slice(startIdx, endSlice);
107
- // Rejoin lines
108
- finalContent = selectedLines.join('\n');
109
- partial = true;
110
- range = [start, Math.min(end, lineCount)];
111
- }
112
- // Format output
113
- const output = {
114
- path: validated.relative,
115
- content: finalContent,
116
- metadata: {
117
- size: stats.size,
118
- lines: lineCount,
119
- modified: stats.mtime.toISOString(),
120
- type: validated.type,
121
- ...(partial && { partial: true, range }),
122
- },
123
- };
124
- return {
125
- content: [
126
- {
127
- type: 'text',
128
- text: JSON.stringify(output, null, 2),
129
- },
130
- ],
131
- };
132
- }
133
- catch (error) {
134
- // Handle DocumentError
135
- if (error instanceof Error && 'code' in error) {
136
- const docError = error;
137
- return {
138
- content: [
139
- {
140
- type: 'text',
141
- text: `Error: ${docError.message}${docError.path ? ` (path: ${docError.path})` : ''}`,
142
- },
143
- ],
144
- isError: true,
145
- };
146
- }
147
- // Handle file system errors
148
- if (error instanceof Error) {
149
- // Check for ENOENT (file not found)
150
- if ('code' in error && error.code === 'ENOENT') {
151
- throw notFound(path);
152
- }
153
- return {
154
- content: [
155
- {
156
- type: 'text',
157
- text: `Error reading file: ${error.message}`,
158
- },
159
- ],
160
- isError: true,
161
- };
162
- }
163
- return {
164
- content: [
165
- {
166
- type: 'text',
167
- text: `Unknown error: ${String(error)}`,
168
- },
169
- ],
170
- isError: true,
171
- };
172
- }
173
- }
174
- //# sourceMappingURL=read-doc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read-doc.js","sourceRoot":"","sources":["../../src/tools/read-doc.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CA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;wBACZ,IAAI,EAAE,UAAU,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;qBACtF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAED,4BAA4B;QAC5B,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,oCAAoC;YACpC,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC/C,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;YAED,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,uBAAuB,KAAK,CAAC,OAAO,EAAE;qBAC7C;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,kBAAkB,MAAM,CAAC,KAAK,CAAC,EAAE;iBACxC;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,54 +0,0 @@
1
- /**
2
- * rlm_multi_query tool: Execute JavaScript code on multiple documents.
3
- * Feature #4: RLM Multi-Query Tool
4
- *
5
- * Enables cross-document analysis with glob patterns or explicit paths.
6
- */
7
- import { z } from 'zod';
8
- import type { ToolContext, ToolResult } from '../types.js';
9
- /**
10
- * Base input schema for rlm_multi_query tool (for registration).
11
- */
12
- export declare const RlmMultiQueryInputBaseSchema: z.ZodObject<{
13
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
- pattern: z.ZodOptional<z.ZodString>;
15
- code: z.ZodString;
16
- sub_query: z.ZodOptional<z.ZodString>;
17
- timeout: z.ZodDefault<z.ZodNumber>;
18
- max_docs: z.ZodDefault<z.ZodNumber>;
19
- }, z.core.$strip>;
20
- /**
21
- * Input schema for rlm_multi_query tool (with validation).
22
- */
23
- export declare const RlmMultiQueryInputSchema: z.ZodObject<{
24
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
- pattern: z.ZodOptional<z.ZodString>;
26
- code: z.ZodString;
27
- sub_query: z.ZodOptional<z.ZodString>;
28
- timeout: z.ZodDefault<z.ZodNumber>;
29
- max_docs: z.ZodDefault<z.ZodNumber>;
30
- }, z.core.$strip>;
31
- export type RlmMultiQueryInput = z.infer<typeof RlmMultiQueryInputSchema>;
32
- /**
33
- * Output interface for rlm_multi_query tool.
34
- */
35
- export interface RlmMultiQueryOutput {
36
- result: unknown;
37
- docs_loaded: number;
38
- execution_time_ms: number;
39
- sub_results?: unknown[];
40
- metadata: {
41
- paths: string[];
42
- total_size: number;
43
- result_size: number;
44
- };
45
- }
46
- /**
47
- * Handle rlm_multi_query tool request.
48
- *
49
- * @param input - Tool input
50
- * @param context - Tool context
51
- * @returns Tool result
52
- */
53
- export declare function handleRlmMultiQuery(input: RlmMultiQueryInput, context: ToolContext): Promise<ToolResult>;
54
- //# sourceMappingURL=rlm-multi-query.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rlm-multi-query.d.ts","sourceRoot":"","sources":["../../src/tools/rlm-multi-query.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQ3D;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;iBAOvC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;iBAOnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AA0GD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,kBAAkB,EACzB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAmPrB"}
@@ -1,348 +0,0 @@
1
- /**
2
- * rlm_multi_query tool: Execute JavaScript code on multiple documents.
3
- * Feature #4: RLM Multi-Query Tool
4
- *
5
- * Enables cross-document analysis with glob patterns or explicit paths.
6
- */
7
- import { z } from 'zod';
8
- import { readFile, stat, readdir } from 'fs/promises';
9
- import { existsSync } from 'fs';
10
- import { join, dirname } from 'path';
11
- import micromatch from 'micromatch';
12
- import { validatePath } from '../utils/paths.js';
13
- import { validationError } from '../utils/errors.js';
14
- import { createEnvironment } from '../rlm/sandbox.js';
15
- import { validateCode } from '../rlm/security.js';
16
- import { processSubCalls } from '../rlm/recursion.js';
17
- /**
18
- * Base input schema for rlm_multi_query tool (for registration).
19
- */
20
- export const RlmMultiQueryInputBaseSchema = z.object({
21
- paths: z.array(z.string().min(1)).optional().describe('Explicit list of document paths'),
22
- pattern: z.string().optional().describe('Glob pattern (e.g., "plans/*/plan.md")'),
23
- code: z.string().min(1).describe('JavaScript code to execute (docs array available)'),
24
- sub_query: z.string().optional().describe('Prompt for recursive LLM processing'),
25
- timeout: z.number().int().min(100).max(30000).default(5000),
26
- max_docs: z.number().int().min(1).max(50).default(20).describe('Maximum documents to load'),
27
- });
28
- /**
29
- * Input schema for rlm_multi_query tool (with validation).
30
- */
31
- export const RlmMultiQueryInputSchema = RlmMultiQueryInputBaseSchema.refine((data) => data.paths || data.pattern, {
32
- message: 'Either paths or pattern must be provided',
33
- }).refine((data) => !(data.paths && data.pattern), {
34
- message: 'Cannot provide both paths and pattern',
35
- });
36
- /**
37
- * Get repository root from config.
38
- */
39
- function getRepoRoot(config) {
40
- if (config.docsPaths && config.docsPaths.length > 0) {
41
- return config.docsPaths[0];
42
- }
43
- return dirname(config.plansPath);
44
- }
45
- /**
46
- * Recursively find files matching a glob pattern.
47
- *
48
- * @param repoRoot - Repository root directory
49
- * @param pattern - Glob pattern (e.g., "plans/**\/plan.md")
50
- * @param maxDepth - Maximum directory depth to search
51
- * @returns Array of relative file paths
52
- */
53
- async function resolveGlobPattern(repoRoot, pattern, maxDepth = 10) {
54
- const matches = [];
55
- async function walkDirectory(dirPath, _relativePath, currentDepth) {
56
- if (currentDepth > maxDepth) {
57
- return;
58
- }
59
- if (!existsSync(dirPath)) {
60
- return;
61
- }
62
- try {
63
- const entries = await readdir(dirPath, { withFileTypes: true });
64
- for (const entry of entries) {
65
- // Skip hidden files and directories
66
- if (entry.name.startsWith('.')) {
67
- continue;
68
- }
69
- const fullPath = join(dirPath, entry.name);
70
- const entryRelativePath = _relativePath ? join(_relativePath, entry.name) : entry.name;
71
- if (entry.isDirectory()) {
72
- // Recurse into subdirectories
73
- await walkDirectory(fullPath, entryRelativePath, currentDepth + 1);
74
- }
75
- else if (entry.isFile()) {
76
- // Check if file matches pattern
77
- // Convert pattern to match against relative path from repo root
78
- if (micromatch.isMatch(entryRelativePath, pattern)) {
79
- matches.push(entryRelativePath);
80
- }
81
- }
82
- }
83
- }
84
- catch {
85
- // Ignore permission errors or other issues
86
- }
87
- }
88
- await walkDirectory(repoRoot, '', 0);
89
- return matches;
90
- }
91
- /**
92
- * Load a document and create DocVariable.
93
- */
94
- async function loadDocument(repoRoot, relativePath) {
95
- try {
96
- // Validate path
97
- const validated = validatePath(relativePath, repoRoot);
98
- // Check if file exists
99
- if (!existsSync(validated.absolute)) {
100
- return null;
101
- }
102
- // Read file stats and content
103
- const stats = await stat(validated.absolute);
104
- const content = await readFile(validated.absolute, 'utf-8');
105
- const docSize = Buffer.byteLength(content, 'utf-8');
106
- return {
107
- content,
108
- metadata: {
109
- path: validated.relative,
110
- size: docSize,
111
- lines: content === '' ? 0 : content.split('\n').length,
112
- modified: stats.mtime.toISOString(),
113
- },
114
- path: validated.relative,
115
- };
116
- }
117
- catch {
118
- // Return null if file can't be loaded
119
- return null;
120
- }
121
- }
122
- /**
123
- * Handle rlm_multi_query tool request.
124
- *
125
- * @param input - Tool input
126
- * @param context - Tool context
127
- * @returns Tool result
128
- */
129
- export async function handleRlmMultiQuery(input, context) {
130
- // Validate input (defense in depth - should already be validated by tool registration)
131
- try {
132
- RlmMultiQueryInputSchema.parse(input);
133
- }
134
- catch (error) {
135
- // Handle Zod validation errors
136
- if (error && typeof error === 'object' && 'issues' in error) {
137
- const zodError = error;
138
- return {
139
- content: [
140
- {
141
- type: 'text',
142
- text: `Validation error: ${zodError.issues.map((i) => i.message).join(', ')}`,
143
- },
144
- ],
145
- isError: true,
146
- };
147
- }
148
- throw error;
149
- }
150
- const { paths, pattern, code, sub_query, timeout = 5000, max_docs = 20 } = input;
151
- const { config } = context;
152
- try {
153
- // Get repo root
154
- const repoRoot = getRepoRoot(config);
155
- // Resolve document paths
156
- let docPaths = [];
157
- if (paths) {
158
- // Use explicit paths
159
- docPaths = paths;
160
- }
161
- else if (pattern) {
162
- // Resolve glob pattern
163
- const matchedPaths = await resolveGlobPattern(repoRoot, pattern);
164
- // Enforce max_docs limit
165
- if (matchedPaths.length > max_docs) {
166
- throw validationError('pattern', `Pattern matched ${matchedPaths.length} documents, exceeding max_docs limit of ${max_docs}`);
167
- }
168
- docPaths = matchedPaths;
169
- }
170
- // Empty result (0 docs) should return empty array, not error (per gotchas)
171
- if (docPaths.length === 0) {
172
- const output = {
173
- result: [],
174
- docs_loaded: 0,
175
- execution_time_ms: 0,
176
- metadata: {
177
- paths: [],
178
- total_size: 0,
179
- result_size: 0,
180
- },
181
- };
182
- return {
183
- content: [
184
- {
185
- type: 'text',
186
- text: JSON.stringify(output, null, 2),
187
- },
188
- ],
189
- };
190
- }
191
- // Load all documents
192
- const docPromises = docPaths.map((path) => loadDocument(repoRoot, path));
193
- const docResults = await Promise.all(docPromises);
194
- // Filter out nulls (files that couldn't be loaded)
195
- const docs = docResults.filter((doc) => doc !== null);
196
- // Validate code before execution
197
- validateCode(code);
198
- // Calculate total size
199
- const totalSize = docs.reduce((sum, doc) => sum + doc.metadata.size, 0);
200
- // Create sandbox environment with docs array
201
- const env = await createEnvironment(docs, { timeout });
202
- try {
203
- // Execute code
204
- const execResult = await env.execute(code);
205
- // Calculate result size
206
- const resultJson = JSON.stringify(execResult.result);
207
- const resultSize = Buffer.byteLength(resultJson, 'utf-8');
208
- // Build output
209
- const output = {
210
- result: execResult.result,
211
- docs_loaded: docs.length,
212
- execution_time_ms: Math.max(1, Math.round(execResult.executionTimeMs)), // Ensure at least 1ms
213
- metadata: {
214
- paths: docs.map((doc) => doc.path),
215
- total_size: totalSize,
216
- result_size: resultSize,
217
- },
218
- };
219
- // Handle sub_query (Agent 3 implementation)
220
- if (sub_query) {
221
- try {
222
- // Get sampling client from context (if available)
223
- // For now, this will be undefined in real server, but tests can provide mock client
224
- const samplingClient = context
225
- .samplingClient;
226
- // Normalize items to array
227
- const items = Array.isArray(execResult.result) ? execResult.result : [execResult.result];
228
- // Process sub-calls
229
- const subResults = await processSubCalls(items, sub_query, {
230
- maxDepth: 1, // Default to 1 for multi-query (can be made configurable later)
231
- concurrency: 5,
232
- timeout: timeout,
233
- samplingClient,
234
- });
235
- // Map results to output format
236
- output.sub_results = subResults.map((r) => (r.success ? r.result : { error: r.error }));
237
- }
238
- catch (error) {
239
- // If sub-call processing fails, include error in sub_results
240
- const errorMessage = error instanceof Error ? error.message : String(error);
241
- output.sub_results = [
242
- {
243
- error: `Sub-call processing failed: ${errorMessage}`,
244
- },
245
- ];
246
- }
247
- }
248
- return {
249
- content: [
250
- {
251
- type: 'text',
252
- text: JSON.stringify(output, null, 2),
253
- },
254
- ],
255
- };
256
- }
257
- finally {
258
- // Always dispose environment
259
- env.dispose();
260
- }
261
- }
262
- catch (error) {
263
- // Handle Zod validation errors
264
- if (error && typeof error === 'object' && 'issues' in error) {
265
- const zodError = error;
266
- return {
267
- content: [
268
- {
269
- type: 'text',
270
- text: `Validation error: ${zodError.issues.map((i) => i.message).join(', ')}`,
271
- },
272
- ],
273
- isError: true,
274
- };
275
- }
276
- // Handle DocumentError
277
- if (error instanceof Error && 'code' in error) {
278
- const docError = error;
279
- return {
280
- content: [
281
- {
282
- type: 'text',
283
- text: `Error: ${docError.message}${docError.path ? ` (path: ${docError.path})` : ''}`,
284
- },
285
- ],
286
- isError: true,
287
- };
288
- }
289
- // Handle security errors
290
- if (error instanceof Error && error.name === 'SecurityError') {
291
- return {
292
- content: [
293
- {
294
- type: 'text',
295
- text: `Security error: ${error.message}`,
296
- },
297
- ],
298
- isError: true,
299
- };
300
- }
301
- // Handle timeout errors
302
- if (error instanceof Error && error.name === 'TimeoutError') {
303
- return {
304
- content: [
305
- {
306
- type: 'text',
307
- text: `Execution timeout: ${error.message}`,
308
- },
309
- ],
310
- isError: true,
311
- };
312
- }
313
- // Handle memory errors
314
- if (error instanceof Error && error.name === 'MemoryError') {
315
- return {
316
- content: [
317
- {
318
- type: 'text',
319
- text: `Memory limit exceeded: ${error.message}`,
320
- },
321
- ],
322
- isError: true,
323
- };
324
- }
325
- // Handle other errors
326
- if (error instanceof Error) {
327
- return {
328
- content: [
329
- {
330
- type: 'text',
331
- text: `Error executing multi-query: ${error.message}`,
332
- },
333
- ],
334
- isError: true,
335
- };
336
- }
337
- return {
338
- content: [
339
- {
340
- type: 'text',
341
- text: `Unknown error: ${String(error)}`,
342
- },
343
- ],
344
- isError: true,
345
- };
346
- }
347
- }
348
- //# sourceMappingURL=rlm-multi-query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rlm-multi-query.js","sourceRoot":"","sources":["../../src/tools/rlm-multi-query.ts"],"names":[],"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query tool: Execute JavaScript code on a single document.
3
- * Feature #2: RLM Query Tool
4
- *
5
- * Enables Claude to load documents as environment variables and execute
6
- * filter/transform code before LLM reasoning.
7
- */
8
- import { z } from 'zod';
9
- import type { ToolContext, ToolResult } from '../types.js';
10
- /**
11
- * Input schema for rlm_query tool.
12
- */
13
- export declare const RlmQueryInputSchema: z.ZodObject<{
14
- path: z.ZodString;
15
- code: z.ZodString;
16
- sub_query: z.ZodOptional<z.ZodString>;
17
- timeout: z.ZodDefault<z.ZodNumber>;
18
- max_depth: z.ZodDefault<z.ZodNumber>;
19
- }, z.core.$strip>;
20
- export type RlmQueryInput = z.infer<typeof RlmQueryInputSchema>;
21
- /**
22
- * Output interface for rlm_query tool.
23
- */
24
- export interface RlmQueryOutput {
25
- result: unknown;
26
- sub_results?: unknown[];
27
- execution_time_ms: number;
28
- tokens_saved?: number;
29
- metadata: {
30
- path: string;
31
- doc_size: number;
32
- result_size: number;
33
- depth: number;
34
- };
35
- }
36
- /**
37
- * Handle rlm_query tool request.
38
- *
39
- * @param input - Tool input
40
- * @param context - Tool context
41
- * @returns Tool result
42
- */
43
- export declare function handleRlmQuery(input: RlmQueryInput, context: ToolContext): Promise<ToolResult>;
44
- //# sourceMappingURL=rlm-query.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rlm-query.d.ts","sourceRoot":"","sources":["../../src/tools/rlm-query.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQ3D;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;iBAY9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAqBD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CA6LrB"}
@@ -1,228 +0,0 @@
1
- /**
2
- * rlm_query tool: Execute JavaScript code on a single document.
3
- * Feature #2: RLM Query Tool
4
- *
5
- * Enables Claude to load documents as environment variables and execute
6
- * filter/transform code before LLM reasoning.
7
- */
8
- import { z } from 'zod';
9
- import { readFile, stat } from 'fs/promises';
10
- import { existsSync } from 'fs';
11
- import { dirname } from 'path';
12
- import { validatePath } from '../utils/paths.js';
13
- import { notFound } from '../utils/errors.js';
14
- import { createEnvironment } from '../rlm/sandbox.js';
15
- import { validateCode } from '../rlm/security.js';
16
- import { processSubCalls } from '../rlm/recursion.js';
17
- /**
18
- * Input schema for rlm_query tool.
19
- */
20
- export const RlmQueryInputSchema = z.object({
21
- path: z.string().min(1).describe('Document path relative to repo root'),
22
- code: z.string().min(1).describe('JavaScript code to execute (doc variable available)'),
23
- sub_query: z.string().optional().describe('Prompt for recursive LLM processing of results'),
24
- timeout: z.number().int().min(100).max(30000).default(5000).describe('Execution timeout in ms'),
25
- max_depth: z
26
- .number()
27
- .int()
28
- .min(1)
29
- .max(3)
30
- .default(1)
31
- .describe('Maximum recursion depth for sub_query'),
32
- });
33
- /**
34
- * Get repository root from config.
35
- */
36
- function getRepoRoot(config) {
37
- if (config.docsPaths && config.docsPaths.length > 0) {
38
- return config.docsPaths[0];
39
- }
40
- return dirname(config.plansPath);
41
- }
42
- /**
43
- * Estimate tokens saved by filtering.
44
- * Rough approximation: 4 characters per token.
45
- */
46
- function estimateTokensSaved(docSize, resultSize) {
47
- const charsSaved = docSize - resultSize;
48
- return Math.max(0, Math.floor(charsSaved / 4));
49
- }
50
- /**
51
- * Handle rlm_query tool request.
52
- *
53
- * @param input - Tool input
54
- * @param context - Tool context
55
- * @returns Tool result
56
- */
57
- export async function handleRlmQuery(input, context) {
58
- const { path, code, sub_query, timeout = 5000 } = input;
59
- const { config } = context;
60
- try {
61
- // Get repo root
62
- const repoRoot = getRepoRoot(config);
63
- // Validate path BEFORE loading (per gotchas)
64
- const validated = validatePath(path, repoRoot);
65
- // Check if file exists
66
- if (!existsSync(validated.absolute)) {
67
- throw notFound(path);
68
- }
69
- // Read file stats and content
70
- const stats = await stat(validated.absolute);
71
- const content = await readFile(validated.absolute, 'utf-8');
72
- const docSize = Buffer.byteLength(content, 'utf-8');
73
- // Create DocVariable
74
- const docVar = {
75
- content,
76
- metadata: {
77
- path: validated.relative,
78
- size: docSize,
79
- lines: content === '' ? 0 : content.split('\n').length,
80
- modified: stats.mtime.toISOString(),
81
- },
82
- path: validated.relative,
83
- };
84
- // Validate code before execution (per TDD requirement)
85
- validateCode(code);
86
- // Create sandbox environment
87
- const env = await createEnvironment(docVar, { timeout });
88
- try {
89
- // Execute code
90
- const execResult = await env.execute(code);
91
- // Calculate result size (serialize to estimate)
92
- const resultJson = JSON.stringify(execResult.result);
93
- const resultSize = Buffer.byteLength(resultJson, 'utf-8');
94
- // Estimate tokens saved
95
- const tokensSaved = estimateTokensSaved(docSize, resultSize);
96
- // Build output
97
- const output = {
98
- result: execResult.result,
99
- execution_time_ms: Math.max(1, Math.round(execResult.executionTimeMs)), // Ensure at least 1ms
100
- tokens_saved: tokensSaved,
101
- metadata: {
102
- path: validated.relative,
103
- doc_size: docSize,
104
- result_size: resultSize,
105
- depth: 0, // Current depth (updated if sub_query is processed)
106
- },
107
- };
108
- // Handle sub_query (Agent 3 implementation)
109
- if (sub_query) {
110
- try {
111
- // Get sampling client from context (if available)
112
- // For now, this will be undefined in real server, but tests can provide mock client
113
- const samplingClient = context
114
- .samplingClient;
115
- // Normalize items to array
116
- const items = Array.isArray(execResult.result) ? execResult.result : [execResult.result];
117
- // Process sub-calls
118
- const subResults = await processSubCalls(items, sub_query, {
119
- maxDepth: input.max_depth ?? 1,
120
- concurrency: 5,
121
- timeout: timeout,
122
- samplingClient,
123
- });
124
- // Map results to output format
125
- output.sub_results = subResults.map((r) => (r.success ? r.result : { error: r.error }));
126
- output.metadata.depth = 1; // Update depth after processing sub-calls
127
- }
128
- catch (error) {
129
- // If sub-call processing fails, include error in sub_results
130
- const errorMessage = error instanceof Error ? error.message : String(error);
131
- output.sub_results = [
132
- {
133
- error: `Sub-call processing failed: ${errorMessage}`,
134
- },
135
- ];
136
- }
137
- }
138
- return {
139
- content: [
140
- {
141
- type: 'text',
142
- text: JSON.stringify(output, null, 2),
143
- },
144
- ],
145
- };
146
- }
147
- finally {
148
- // Always dispose environment
149
- env.dispose();
150
- }
151
- }
152
- catch (error) {
153
- // Handle DocumentError
154
- if (error instanceof Error && 'code' in error) {
155
- const docError = error;
156
- return {
157
- content: [
158
- {
159
- type: 'text',
160
- text: `Error: ${docError.message}${docError.path ? ` (path: ${docError.path})` : ''}`,
161
- },
162
- ],
163
- isError: true,
164
- };
165
- }
166
- // Handle security errors
167
- if (error instanceof Error && error.name === 'SecurityError') {
168
- return {
169
- content: [
170
- {
171
- type: 'text',
172
- text: `Security error: ${error.message}`,
173
- },
174
- ],
175
- isError: true,
176
- };
177
- }
178
- // Handle timeout errors
179
- if (error instanceof Error && error.name === 'TimeoutError') {
180
- return {
181
- content: [
182
- {
183
- type: 'text',
184
- text: `Execution timeout: ${error.message}`,
185
- },
186
- ],
187
- isError: true,
188
- };
189
- }
190
- // Handle memory errors
191
- if (error instanceof Error && error.name === 'MemoryError') {
192
- return {
193
- content: [
194
- {
195
- type: 'text',
196
- text: `Memory limit exceeded: ${error.message}`,
197
- },
198
- ],
199
- isError: true,
200
- };
201
- }
202
- // Handle file system errors
203
- if (error instanceof Error) {
204
- if ('code' in error && error.code === 'ENOENT') {
205
- throw notFound(path);
206
- }
207
- return {
208
- content: [
209
- {
210
- type: 'text',
211
- text: `Error executing query: ${error.message}`,
212
- },
213
- ],
214
- isError: true,
215
- };
216
- }
217
- return {
218
- content: [
219
- {
220
- type: 'text',
221
- text: `Unknown error: ${String(error)}`,
222
- },
223
- ],
224
- isError: true,
225
- };
226
- }
227
- }
228
- //# sourceMappingURL=rlm-query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rlm-query.js","sourceRoot":"","sources":["../../src/tools/rlm-query.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAoB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IACvE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qDAAqD,CAAC;IACvF,SAAS,EAAE,CAAC,CAAC,MAAM,EAA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