@oratis/lisa 0.7.0 → 0.9.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/autostart/install.d.ts +28 -0
- package/dist/autostart/install.d.ts.map +1 -0
- package/dist/autostart/install.js +180 -0
- package/dist/autostart/install.js.map +1 -0
- package/dist/cli.js +49 -1
- package/dist/cli.js.map +1 -1
- package/dist/heartbeat/install.d.ts.map +1 -1
- package/dist/heartbeat/install.js +1 -43
- package/dist/heartbeat/install.js.map +1 -1
- package/dist/heartbeat/runner.d.ts.map +1 -1
- package/dist/heartbeat/runner.js +11 -0
- package/dist/heartbeat/runner.js.map +1 -1
- package/dist/integrations/aider/observer.d.ts +48 -0
- package/dist/integrations/aider/observer.d.ts.map +1 -0
- package/dist/integrations/aider/observer.js +196 -0
- package/dist/integrations/aider/observer.js.map +1 -0
- package/dist/integrations/comparisons.d.ts +23 -0
- package/dist/integrations/comparisons.d.ts.map +1 -0
- package/dist/integrations/comparisons.js +47 -0
- package/dist/integrations/comparisons.js.map +1 -0
- package/dist/integrations/github-pr/observer.d.ts +85 -0
- package/dist/integrations/github-pr/observer.d.ts.map +1 -0
- package/dist/integrations/github-pr/observer.js +261 -0
- package/dist/integrations/github-pr/observer.js.map +1 -0
- package/dist/integrations/hub.d.ts.map +1 -1
- package/dist/integrations/hub.js +10 -0
- package/dist/integrations/hub.js.map +1 -1
- package/dist/integrations/opencode/observer.d.ts +74 -0
- package/dist/integrations/opencode/observer.d.ts.map +1 -0
- package/dist/integrations/opencode/observer.js +207 -0
- package/dist/integrations/opencode/observer.js.map +1 -0
- package/dist/integrations/registry.d.ts.map +1 -1
- package/dist/integrations/registry.js +3 -1
- package/dist/integrations/registry.js.map +1 -1
- package/dist/integrations/scheduled-dispatch.d.ts +42 -0
- package/dist/integrations/scheduled-dispatch.d.ts.map +1 -0
- package/dist/integrations/scheduled-dispatch.js +140 -0
- package/dist/integrations/scheduled-dispatch.js.map +1 -0
- package/dist/launchd.d.ts +18 -0
- package/dist/launchd.d.ts.map +1 -0
- package/dist/launchd.js +60 -0
- package/dist/launchd.js.map +1 -0
- package/dist/mcp/config.d.ts +4 -0
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +34 -0
- package/dist/mcp/config.js.map +1 -1
- package/dist/orchestrator/journal.d.ts +46 -0
- package/dist/orchestrator/journal.d.ts.map +1 -0
- package/dist/orchestrator/journal.js +82 -0
- package/dist/orchestrator/journal.js.map +1 -0
- package/dist/orchestrator/recap.d.ts +38 -0
- package/dist/orchestrator/recap.d.ts.map +1 -0
- package/dist/orchestrator/recap.js +134 -0
- package/dist/orchestrator/recap.js.map +1 -0
- package/dist/screen_advisor/engine.d.ts +79 -0
- package/dist/screen_advisor/engine.d.ts.map +1 -0
- package/dist/screen_advisor/engine.js +128 -0
- package/dist/screen_advisor/engine.js.map +1 -0
- package/dist/soul/lock.d.ts +7 -4
- package/dist/soul/lock.d.ts.map +1 -1
- package/dist/soul/lock.js +33 -9
- package/dist/soul/lock.js.map +1 -1
- package/dist/tools/agent_recap.d.ts +21 -0
- package/dist/tools/agent_recap.d.ts.map +1 -0
- package/dist/tools/agent_recap.js +43 -0
- package/dist/tools/agent_recap.js.map +1 -0
- package/dist/tools/compare_agents.d.ts +16 -0
- package/dist/tools/compare_agents.d.ts.map +1 -0
- package/dist/tools/compare_agents.js +145 -0
- package/dist/tools/compare_agents.js.map +1 -0
- package/dist/tools/dispatch_agent.d.ts +13 -0
- package/dist/tools/dispatch_agent.d.ts.map +1 -1
- package/dist/tools/dispatch_agent.js +46 -46
- package/dist/tools/dispatch_agent.js.map +1 -1
- package/dist/tools/exec-util.d.ts +18 -0
- package/dist/tools/exec-util.d.ts.map +1 -0
- package/dist/tools/exec-util.js +72 -0
- package/dist/tools/exec-util.js.map +1 -0
- package/dist/tools/github.d.ts +34 -0
- package/dist/tools/github.d.ts.map +1 -0
- package/dist/tools/github.js +140 -0
- package/dist/tools/github.js.map +1 -0
- package/dist/tools/github_link.d.ts +36 -0
- package/dist/tools/github_link.d.ts.map +1 -0
- package/dist/tools/github_link.js +127 -0
- package/dist/tools/github_link.js.map +1 -0
- package/dist/tools/inspect_agent.d.ts +21 -0
- package/dist/tools/inspect_agent.d.ts.map +1 -0
- package/dist/tools/inspect_agent.js +87 -0
- package/dist/tools/inspect_agent.js.map +1 -0
- package/dist/tools/list_agents.d.ts +21 -0
- package/dist/tools/list_agents.d.ts.map +1 -0
- package/dist/tools/list_agents.js +88 -0
- package/dist/tools/list_agents.js.map +1 -0
- package/dist/tools/mcp.d.ts +28 -0
- package/dist/tools/mcp.d.ts.map +1 -0
- package/dist/tools/mcp.js +55 -0
- package/dist/tools/mcp.js.map +1 -0
- package/dist/tools/npm_info.d.ts +21 -0
- package/dist/tools/npm_info.d.ts.map +1 -0
- package/dist/tools/npm_info.js +102 -0
- package/dist/tools/npm_info.js.map +1 -0
- package/dist/tools/pr_status.d.ts +31 -0
- package/dist/tools/pr_status.d.ts.map +1 -0
- package/dist/tools/pr_status.js +90 -0
- package/dist/tools/pr_status.js.map +1 -0
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +27 -0
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/repo_digest.d.ts +33 -0
- package/dist/tools/repo_digest.d.ts.map +1 -0
- package/dist/tools/repo_digest.js +113 -0
- package/dist/tools/repo_digest.js.map +1 -0
- package/dist/tools/review_diff.d.ts +28 -0
- package/dist/tools/review_diff.d.ts.map +1 -0
- package/dist/tools/review_diff.js +68 -0
- package/dist/tools/review_diff.js.map +1 -0
- package/dist/tools/run_checks.d.ts +15 -0
- package/dist/tools/run_checks.d.ts.map +1 -0
- package/dist/tools/run_checks.js +117 -0
- package/dist/tools/run_checks.js.map +1 -0
- package/dist/tools/scheduled_dispatch.d.ts +27 -0
- package/dist/tools/scheduled_dispatch.d.ts.map +1 -0
- package/dist/tools/scheduled_dispatch.js +57 -0
- package/dist/tools/scheduled_dispatch.js.map +1 -0
- package/dist/voice/dictation.d.ts +51 -0
- package/dist/voice/dictation.d.ts.map +1 -0
- package/dist/voice/dictation.js +70 -0
- package/dist/voice/dictation.js.map +1 -0
- package/dist/web/island.d.ts +1 -1
- package/dist/web/island.d.ts.map +1 -1
- package/dist/web/island.js +84 -8
- package/dist/web/island.js.map +1 -1
- package/dist/web/lisa-html.d.ts +1 -1
- package/dist/web/lisa-html.d.ts.map +1 -1
- package/dist/web/lisa-html.js +80 -13
- package/dist/web/lisa-html.js.map +1 -1
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +156 -1
- package/dist/web/server.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ToolDefinition } from "../types.js";
|
|
2
|
+
interface GithubLinkInput {
|
|
3
|
+
/** What to link: repo (default), branch, commit, file, pr, issue. */
|
|
4
|
+
target?: "repo" | "branch" | "commit" | "file" | "pr" | "issue";
|
|
5
|
+
cwd?: string;
|
|
6
|
+
/** Branch name or commit sha; defaults to the current branch/HEAD. */
|
|
7
|
+
ref?: string;
|
|
8
|
+
/** For target:file — path (absolute or repo-relative). */
|
|
9
|
+
path?: string;
|
|
10
|
+
start_line?: number;
|
|
11
|
+
end_line?: number;
|
|
12
|
+
/** For target:pr/issue — the number. */
|
|
13
|
+
number?: number;
|
|
14
|
+
/** Also open the URL in the default browser. */
|
|
15
|
+
open?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface Remote {
|
|
18
|
+
host: string;
|
|
19
|
+
owner: string;
|
|
20
|
+
repo: string;
|
|
21
|
+
}
|
|
22
|
+
/** Parse a git remote URL (scp or https/ssh) into host/owner/repo. Pure. */
|
|
23
|
+
export declare function parseRemote(url: string): Remote | null;
|
|
24
|
+
/** Build a GitHub URL for the given target. Pure + tested. */
|
|
25
|
+
export declare function buildUrl(r: Remote, target: NonNullable<GithubLinkInput["target"]>, opts?: {
|
|
26
|
+
ref?: string;
|
|
27
|
+
path?: string;
|
|
28
|
+
startLine?: number;
|
|
29
|
+
endLine?: number;
|
|
30
|
+
number?: number;
|
|
31
|
+
}): string | {
|
|
32
|
+
error: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const githubLinkTool: ToolDefinition<GithubLinkInput, string>;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=github_link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github_link.d.ts","sourceRoot":"","sources":["../../src/tools/github_link.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,UAAU,eAAe;IACvB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAatD;AAED,8DAA8D;AAC9D,wBAAgB,QAAQ,CACtB,CAAC,EAAE,MAAM,EACT,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,EAC9C,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAChG,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CA2B5B;AAED,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,eAAe,EAAE,MAAM,CAgElE,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* github_link (vibe-coding) — turn the local git context into a shareable
|
|
3
|
+
* GitHub URL: the repo, a branch, a commit, a file (optionally with a line
|
|
4
|
+
* range), or a PR / issue. So when LISA references "src/web/server.ts:120" or
|
|
5
|
+
* "PR #58" she can hand you a clickable link instead of a path.
|
|
6
|
+
*
|
|
7
|
+
* URL building is pure git (parses `origin`), so it needs no gh. `open:true`
|
|
8
|
+
* best-effort opens it in your browser.
|
|
9
|
+
*/
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { runIn, isDir, gitRoot } from "./exec-util.js";
|
|
12
|
+
/** Parse a git remote URL (scp or https/ssh) into host/owner/repo. Pure. */
|
|
13
|
+
export function parseRemote(url) {
|
|
14
|
+
let s = url.trim().replace(/\.git$/i, "").replace(/\/$/, "");
|
|
15
|
+
// scp-like: git@github.com:owner/repo (also ssh://git@github.com/owner/repo)
|
|
16
|
+
let m = s.match(/^(?:ssh:\/\/)?[^@\s]*@([^:/]+)[:/](.+)$/i);
|
|
17
|
+
if (!m) {
|
|
18
|
+
// url: https://github.com/owner/repo
|
|
19
|
+
m = s.match(/^https?:\/\/(?:[^@/]+@)?([^/]+)\/(.+)$/i);
|
|
20
|
+
}
|
|
21
|
+
if (!m)
|
|
22
|
+
return null;
|
|
23
|
+
const host = m[1];
|
|
24
|
+
const parts = m[2].split("/").filter(Boolean);
|
|
25
|
+
if (parts.length < 2)
|
|
26
|
+
return null;
|
|
27
|
+
return { host, owner: parts[0], repo: parts[1] };
|
|
28
|
+
}
|
|
29
|
+
/** Build a GitHub URL for the given target. Pure + tested. */
|
|
30
|
+
export function buildUrl(r, target, opts = {}) {
|
|
31
|
+
const base = `https://${r.host}/${r.owner}/${r.repo}`;
|
|
32
|
+
switch (target) {
|
|
33
|
+
case "repo":
|
|
34
|
+
return base;
|
|
35
|
+
case "branch":
|
|
36
|
+
return opts.ref ? `${base}/tree/${encodeURIComponent(opts.ref)}` : base;
|
|
37
|
+
case "commit":
|
|
38
|
+
return opts.ref ? `${base}/commit/${opts.ref}` : { error: "commit needs a ref/sha" };
|
|
39
|
+
case "file": {
|
|
40
|
+
if (!opts.path)
|
|
41
|
+
return { error: "file needs a path" };
|
|
42
|
+
const ref = opts.ref || "HEAD";
|
|
43
|
+
const cleanPath = opts.path.split("/").map(encodeURIComponent).join("/").replace(/^\//, "");
|
|
44
|
+
let url = `${base}/blob/${encodeURIComponent(ref)}/${cleanPath}`;
|
|
45
|
+
if (opts.startLine) {
|
|
46
|
+
url += `#L${opts.startLine}`;
|
|
47
|
+
if (opts.endLine && opts.endLine !== opts.startLine)
|
|
48
|
+
url += `-L${opts.endLine}`;
|
|
49
|
+
}
|
|
50
|
+
return url;
|
|
51
|
+
}
|
|
52
|
+
case "pr":
|
|
53
|
+
return opts.number ? `${base}/pull/${opts.number}` : { error: "pr needs a number" };
|
|
54
|
+
case "issue":
|
|
55
|
+
return opts.number ? `${base}/issues/${opts.number}` : { error: "issue needs a number" };
|
|
56
|
+
default:
|
|
57
|
+
return { error: `unknown target: ${target}` };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export const githubLinkTool = {
|
|
61
|
+
name: "github_link",
|
|
62
|
+
description: "Build a shareable GitHub URL from the local git repo: target 'repo' (default), 'branch', " +
|
|
63
|
+
"'commit', 'file' (path + optional start_line/end_line), 'pr' or 'issue' (number). Defaults the " +
|
|
64
|
+
"ref to the current branch / HEAD. Use to give the user a clickable link to a file/line, commit, " +
|
|
65
|
+
"branch, or PR you're referencing. open:true also opens it in the browser. Needs a GitHub `origin` " +
|
|
66
|
+
"remote; no gh required.",
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: "object",
|
|
69
|
+
properties: {
|
|
70
|
+
target: { type: "string", enum: ["repo", "branch", "commit", "file", "pr", "issue"] },
|
|
71
|
+
cwd: { type: "string", description: "Absolute path inside the repo. Defaults to the current directory." },
|
|
72
|
+
ref: { type: "string", description: "Branch name or commit sha. Defaults to the current branch (for file/branch) or HEAD." },
|
|
73
|
+
path: { type: "string", description: "For target:file — absolute or repo-relative file path." },
|
|
74
|
+
start_line: { type: "integer", minimum: 1 },
|
|
75
|
+
end_line: { type: "integer", minimum: 1 },
|
|
76
|
+
number: { type: "integer", minimum: 1, description: "For target:pr or issue." },
|
|
77
|
+
open: { type: "boolean", description: "Also open the URL in the default browser." },
|
|
78
|
+
},
|
|
79
|
+
additionalProperties: false,
|
|
80
|
+
},
|
|
81
|
+
async execute(input, ctx) {
|
|
82
|
+
const cwd = input.cwd && input.cwd.startsWith("/") ? input.cwd : ctx.cwd;
|
|
83
|
+
if (!(await isDir(cwd)))
|
|
84
|
+
return `(not a directory: ${cwd})`;
|
|
85
|
+
const root = await gitRoot(cwd, ctx.signal);
|
|
86
|
+
if (!root)
|
|
87
|
+
return `(not a git repo: ${cwd})`;
|
|
88
|
+
const remoteR = await runIn(root, "git", ["-C", root, "remote", "get-url", "origin"], { timeoutMs: 5000, signal: ctx.signal });
|
|
89
|
+
if (remoteR.code !== 0)
|
|
90
|
+
return "(no `origin` remote on this repo)";
|
|
91
|
+
const remote = parseRemote(remoteR.stdout);
|
|
92
|
+
if (!remote)
|
|
93
|
+
return `(couldn't parse a GitHub URL from origin: ${remoteR.stdout.trim().slice(0, 120)})`;
|
|
94
|
+
const target = input.target ?? "repo";
|
|
95
|
+
// Resolve a default ref for branch/file when none given.
|
|
96
|
+
let ref = input.ref;
|
|
97
|
+
if (!ref && (target === "branch" || target === "file")) {
|
|
98
|
+
const b = await runIn(root, "git", ["-C", root, "rev-parse", "--abbrev-ref", "HEAD"], { timeoutMs: 5000, signal: ctx.signal });
|
|
99
|
+
if (b.code === 0)
|
|
100
|
+
ref = b.stdout.trim();
|
|
101
|
+
}
|
|
102
|
+
if (!ref && target === "commit") {
|
|
103
|
+
const h = await runIn(root, "git", ["-C", root, "rev-parse", "HEAD"], { timeoutMs: 5000, signal: ctx.signal });
|
|
104
|
+
if (h.code === 0)
|
|
105
|
+
ref = h.stdout.trim();
|
|
106
|
+
}
|
|
107
|
+
// For file: make the path repo-relative.
|
|
108
|
+
let filePath = input.path;
|
|
109
|
+
if (target === "file" && filePath) {
|
|
110
|
+
if (filePath.startsWith("/"))
|
|
111
|
+
filePath = path.relative(root, filePath);
|
|
112
|
+
if (filePath.startsWith(".."))
|
|
113
|
+
return `(file is outside the repo: ${input.path})`;
|
|
114
|
+
}
|
|
115
|
+
const built = buildUrl(remote, target, { ref, path: filePath, startLine: input.start_line, endLine: input.end_line, number: input.number });
|
|
116
|
+
if (typeof built !== "string")
|
|
117
|
+
return `(${built.error})`;
|
|
118
|
+
if (input.open) {
|
|
119
|
+
const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
120
|
+
const args = process.platform === "win32" ? ["/c", "start", built] : [built];
|
|
121
|
+
runIn(root, opener, args, { timeoutMs: 5000, signal: ctx.signal }).catch(() => { });
|
|
122
|
+
return `${built}\n(opened in browser)`;
|
|
123
|
+
}
|
|
124
|
+
return built;
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=github_link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github_link.js","sourceRoot":"","sources":["../../src/tools/github_link.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAwBvD,4EAA4E;AAC5E,MAAM,UAAU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AM,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC;YAC1G,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAC7E,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACnF,OAAO,GAAG,KAAK,uBAAuB,CAAC;QACzC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inspect_agent (vibe-coding) — the deep view of ONE observed session, where
|
|
3
|
+
* list_agents is the one-line-each roster. Full structural activity for the
|
|
4
|
+
* matched session: state + reason, branch, turn count, every tool it has run,
|
|
5
|
+
* every file it has touched, last command, pending permission, error, tokens.
|
|
6
|
+
*
|
|
7
|
+
* PRIVACY: structural metadata only — never conversation content (file PATHS
|
|
8
|
+
* and tool NAMES, not contents). For what a repo actually changed, use
|
|
9
|
+
* repo_digest / review_diff against its cwd.
|
|
10
|
+
*/
|
|
11
|
+
import type { ToolDefinition } from "../types.js";
|
|
12
|
+
import type { AgentSession } from "../integrations/types.js";
|
|
13
|
+
interface InspectInput {
|
|
14
|
+
/** Session id (or a prefix), or a project name, to inspect. */
|
|
15
|
+
target: string;
|
|
16
|
+
}
|
|
17
|
+
/** Pure: full structural detail for one session. Exported for tests. */
|
|
18
|
+
export declare function formatDetail(s: AgentSession, now: number): string;
|
|
19
|
+
export declare const inspectAgentTool: ToolDefinition<InspectInput, string>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=inspect_agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect_agent.d.ts","sourceRoot":"","sources":["../../src/tools/inspect_agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,UAAU,YAAY;IACpB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;CAChB;AAUD,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAmBjE;AAYD,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,YAAY,EAAE,MAAM,CAoCjE,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { getCurrentHub } from "../integrations/current-hub.js";
|
|
2
|
+
function ago(ms, now) {
|
|
3
|
+
const s = Math.max(0, Math.floor((now - ms) / 1000));
|
|
4
|
+
if (s < 60)
|
|
5
|
+
return `${s}s ago`;
|
|
6
|
+
const m = Math.floor(s / 60);
|
|
7
|
+
if (m < 60)
|
|
8
|
+
return `${m}m ago`;
|
|
9
|
+
return `${Math.floor(m / 60)}h ago`;
|
|
10
|
+
}
|
|
11
|
+
/** Pure: full structural detail for one session. Exported for tests. */
|
|
12
|
+
export function formatDetail(s, now) {
|
|
13
|
+
const a = s.activity;
|
|
14
|
+
const lines = [];
|
|
15
|
+
lines.push(`${s.project} · ${s.agent} · ${s.sessionId}`);
|
|
16
|
+
lines.push(` state: ${s.state}${s.stateReason ? ` (${s.stateReason})` : ""} · last active ${ago(s.lastMtime, now)}`);
|
|
17
|
+
if (s.cwd)
|
|
18
|
+
lines.push(` cwd: ${s.cwd}`);
|
|
19
|
+
if (a?.gitBranch)
|
|
20
|
+
lines.push(` branch: ${a.gitBranch}`);
|
|
21
|
+
if (typeof a?.turnCount === "number")
|
|
22
|
+
lines.push(` turns: ${a.turnCount}`);
|
|
23
|
+
if (a?.pendingPermission)
|
|
24
|
+
lines.push(` ⏳ waiting on permission: ${a.pendingPermission}`);
|
|
25
|
+
if (a?.lastCommandName)
|
|
26
|
+
lines.push(` last command: ${a.lastCommandName}`);
|
|
27
|
+
if (a?.lastTools && a.lastTools.length)
|
|
28
|
+
lines.push(` tools: ${a.lastTools.join(" → ")}`);
|
|
29
|
+
if (a?.filesTouched && a.filesTouched.length) {
|
|
30
|
+
lines.push(` files touched (${a.filesTouched.length}):`);
|
|
31
|
+
for (const f of a.filesTouched.slice(0, 15))
|
|
32
|
+
lines.push(` ${f}`);
|
|
33
|
+
if (a.filesTouched.length > 15)
|
|
34
|
+
lines.push(` … +${a.filesTouched.length - 15} more`);
|
|
35
|
+
}
|
|
36
|
+
if (a?.tokens)
|
|
37
|
+
lines.push(` tokens: ${a.tokens.input} in / ${a.tokens.output} out`);
|
|
38
|
+
if (a?.lastError)
|
|
39
|
+
lines.push(` error: ${a.lastError}`);
|
|
40
|
+
return lines.join("\n");
|
|
41
|
+
}
|
|
42
|
+
function matches(s, target) {
|
|
43
|
+
const t = target.toLowerCase();
|
|
44
|
+
return (s.sessionId.toLowerCase().startsWith(t) ||
|
|
45
|
+
s.sessionId.toLowerCase() === t ||
|
|
46
|
+
s.project.toLowerCase() === t ||
|
|
47
|
+
s.project.toLowerCase().includes(t));
|
|
48
|
+
}
|
|
49
|
+
export const inspectAgentTool = {
|
|
50
|
+
name: "inspect_agent",
|
|
51
|
+
description: "Deep-dive one observed agent session (by session id / prefix, or project name): its full " +
|
|
52
|
+
"structural activity — state + reason, git branch, turn count, every tool it ran, all files it " +
|
|
53
|
+
"touched, last command, pending permission, errors, token usage. Use when the user asks 'what is " +
|
|
54
|
+
"<session/project> doing in detail'. list_agents is the roster; this is one session. Structural " +
|
|
55
|
+
"metadata only — never conversation content.",
|
|
56
|
+
inputSchema: {
|
|
57
|
+
type: "object",
|
|
58
|
+
properties: {
|
|
59
|
+
target: { type: "string", description: "Session id (or prefix) or project name to inspect." },
|
|
60
|
+
},
|
|
61
|
+
required: ["target"],
|
|
62
|
+
additionalProperties: false,
|
|
63
|
+
},
|
|
64
|
+
async execute(input) {
|
|
65
|
+
const hub = getCurrentHub();
|
|
66
|
+
if (!hub)
|
|
67
|
+
return "(agent monitoring isn't active — start the web server with `lisa serve --web`)";
|
|
68
|
+
const target = (input.target ?? "").trim();
|
|
69
|
+
if (!target)
|
|
70
|
+
return "(give a session id or project name to inspect)";
|
|
71
|
+
const now = Date.now();
|
|
72
|
+
const all = hub.list();
|
|
73
|
+
const hits = all.filter((s) => matches(s, target));
|
|
74
|
+
if (hits.length === 0) {
|
|
75
|
+
const names = all.map((s) => `${s.project} (${s.sessionId.slice(0, 8)})`).slice(0, 10).join(", ");
|
|
76
|
+
return `(no observed session matches "${target}". Active: ${names || "none"})`;
|
|
77
|
+
}
|
|
78
|
+
if (hits.length > 1) {
|
|
79
|
+
// Disambiguate, but still detail the most recently active one.
|
|
80
|
+
hits.sort((a, b) => b.lastMtime - a.lastMtime);
|
|
81
|
+
const head = `(${hits.length} match "${target}"; showing the most recent — narrow by session id)\n`;
|
|
82
|
+
return head + formatDetail(hits[0], now);
|
|
83
|
+
}
|
|
84
|
+
return formatDetail(hits[0], now);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=inspect_agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect_agent.js","sourceRoot":"","sources":["../../src/tools/inspect_agent.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAQ/D,SAAS,GAAG,CAAC,EAAU,EAAE,GAAW;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,IAAI,CAA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AE,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClG,OAAO,iCAAiC,MAAM,cAAc,KAAK,IAAI,MAAM,GAAG,CAAC;QACjF,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,+DAA+D;YAC/D,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;YAC/C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,WAAW,MAAM,sDAAsD,CAAC;YACpG,OAAO,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAE,EAAE,GAAG,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAE,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list_agents (orchestrator OBSERVE — read side) — enumerate the CLI agent
|
|
3
|
+
* sessions LISA is watching (Claude Code, Codex, …) with their structural
|
|
4
|
+
* activity, so she can answer "what are my agents doing right now?" in chat.
|
|
5
|
+
*
|
|
6
|
+
* Fills the gap between:
|
|
7
|
+
* - advise_now — only the relevance-gated *summary* ("10 active, nothing notable")
|
|
8
|
+
* - signal_agent — only LISA's OWN dispatched agents (the user's manual sessions
|
|
9
|
+
* are observed but unreachable there)
|
|
10
|
+
* The sidebar/island already show this data; this exposes it to the chat agent.
|
|
11
|
+
*
|
|
12
|
+
* PRIVACY: structural metadata only — state, project, git branch, tool/command
|
|
13
|
+
* NAMES, file PATHS, counts, error strings. Never a prompt, a reply, or full
|
|
14
|
+
* command arguments. Same boundary the parser privacy tests assert.
|
|
15
|
+
*/
|
|
16
|
+
import type { ToolDefinition } from "../types.js";
|
|
17
|
+
import type { AgentSession } from "../integrations/types.js";
|
|
18
|
+
/** One session → a readable, structural-only line. Pure, for display + tests. */
|
|
19
|
+
export declare function formatSessionLine(s: AgentSession, now: number): string;
|
|
20
|
+
export declare const listAgentsTool: ToolDefinition<Record<string, never>, string>;
|
|
21
|
+
//# sourceMappingURL=list_agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_agents.d.ts","sourceRoot":"","sources":["../../src/tools/list_agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAoB7D,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAiBtE;AAED,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CA2BxE,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list_agents (orchestrator OBSERVE — read side) — enumerate the CLI agent
|
|
3
|
+
* sessions LISA is watching (Claude Code, Codex, …) with their structural
|
|
4
|
+
* activity, so she can answer "what are my agents doing right now?" in chat.
|
|
5
|
+
*
|
|
6
|
+
* Fills the gap between:
|
|
7
|
+
* - advise_now — only the relevance-gated *summary* ("10 active, nothing notable")
|
|
8
|
+
* - signal_agent — only LISA's OWN dispatched agents (the user's manual sessions
|
|
9
|
+
* are observed but unreachable there)
|
|
10
|
+
* The sidebar/island already show this data; this exposes it to the chat agent.
|
|
11
|
+
*
|
|
12
|
+
* PRIVACY: structural metadata only — state, project, git branch, tool/command
|
|
13
|
+
* NAMES, file PATHS, counts, error strings. Never a prompt, a reply, or full
|
|
14
|
+
* command arguments. Same boundary the parser privacy tests assert.
|
|
15
|
+
*/
|
|
16
|
+
import { getCurrentHub } from "../integrations/current-hub.js";
|
|
17
|
+
const STATE_RANK = {
|
|
18
|
+
error: 0,
|
|
19
|
+
waiting: 1,
|
|
20
|
+
working: 2,
|
|
21
|
+
done: 3,
|
|
22
|
+
idle: 4,
|
|
23
|
+
unknown: 5,
|
|
24
|
+
};
|
|
25
|
+
function ago(ms, now) {
|
|
26
|
+
const d = Math.max(0, now - ms);
|
|
27
|
+
const s = Math.floor(d / 1000);
|
|
28
|
+
if (s < 60)
|
|
29
|
+
return `${s}s`;
|
|
30
|
+
const m = Math.floor(s / 60);
|
|
31
|
+
if (m < 60)
|
|
32
|
+
return `${m}m`;
|
|
33
|
+
return `${Math.floor(m / 60)}h`;
|
|
34
|
+
}
|
|
35
|
+
/** One session → a readable, structural-only line. Pure, for display + tests. */
|
|
36
|
+
export function formatSessionLine(s, now) {
|
|
37
|
+
const a = s.activity;
|
|
38
|
+
const bits = [];
|
|
39
|
+
if (a?.gitBranch)
|
|
40
|
+
bits.push(`@${a.gitBranch}`);
|
|
41
|
+
if (a?.pendingPermission)
|
|
42
|
+
bits.push(`⏳ needs permission: ${a.pendingPermission}`);
|
|
43
|
+
else if (a?.lastCommandName)
|
|
44
|
+
bits.push(`$ ${a.lastCommandName}`);
|
|
45
|
+
else if (a?.lastTools && a.lastTools.length)
|
|
46
|
+
bits.push(a.lastTools.slice(-3).join("→"));
|
|
47
|
+
if (a?.lastError)
|
|
48
|
+
bits.push(`error: ${a.lastError}`);
|
|
49
|
+
if (a?.filesTouched && a.filesTouched.length) {
|
|
50
|
+
const f = a.filesTouched
|
|
51
|
+
.slice(-2)
|
|
52
|
+
.map((p) => p.split("/").pop() ?? p)
|
|
53
|
+
.join(", ");
|
|
54
|
+
bits.push(`files: ${f}`);
|
|
55
|
+
}
|
|
56
|
+
const detail = bits.length ? " · " + bits.join(" · ") : "";
|
|
57
|
+
return `• [${s.state}] ${s.project} (${s.agent}, ${ago(s.lastMtime, now)} ago)${detail}`;
|
|
58
|
+
}
|
|
59
|
+
export const listAgentsTool = {
|
|
60
|
+
name: "list_agents",
|
|
61
|
+
description: "List the CLI agent sessions LISA is observing right now (Claude Code, Codex, …) with their " +
|
|
62
|
+
"structural activity: state (working/waiting/error/idle), project, git branch, last tool/command " +
|
|
63
|
+
"NAME, files touched, pending permission, errors. Use when the user asks what their agents are " +
|
|
64
|
+
"doing, what's running, or 'what is <agent> up to'. Structural metadata only — never conversation " +
|
|
65
|
+
"content; to see what a repo actually changed, read its `git log`. For LISA's OWN dispatched " +
|
|
66
|
+
"agents (start/stop) use signal_agent; for a relevance-gated summary use advise_now.",
|
|
67
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
68
|
+
async execute() {
|
|
69
|
+
const hub = getCurrentHub();
|
|
70
|
+
if (!hub) {
|
|
71
|
+
return "(agent monitoring isn't active — start the web server with `lisa serve --web`)";
|
|
72
|
+
}
|
|
73
|
+
const now = Date.now();
|
|
74
|
+
const sessions = hub.list();
|
|
75
|
+
if (sessions.length === 0)
|
|
76
|
+
return "(no agents are active right now)";
|
|
77
|
+
const sorted = sessions.slice().sort((a, b) => {
|
|
78
|
+
const ra = STATE_RANK[a.state] ?? 9;
|
|
79
|
+
const rb = STATE_RANK[b.state] ?? 9;
|
|
80
|
+
if (ra !== rb)
|
|
81
|
+
return ra - rb;
|
|
82
|
+
return b.lastMtime - a.lastMtime;
|
|
83
|
+
});
|
|
84
|
+
const head = `${sessions.length} agent session(s) observed (structural activity only):`;
|
|
85
|
+
return [head, ...sorted.map((s) => formatSessionLine(s, now))].join("\n");
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=list_agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_agents.js","sourceRoot":"","sources":["../../src/tools/list_agents.ts"],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EAAE,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE;IAC5E,KAAK,CAAC,OAAO;QACX,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;QAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,gFAAgF,CAAC;QAC1F,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,kCAAkC,CAAC;QACrE,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YAC5C,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpC,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpC,IAAI,EAAE,KAAK,EAAE;gBAAE,OAAO,EAAE,GAAG,EAAE,CAAC;YAC9B,OAAO,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,GAAG,QAAQ,CAAC,MAAM,wDAAwD,CAAC;QACxF,OAAO,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5E,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mcp (integration) — manage LISA's MCP server connections, so she can connect
|
|
3
|
+
* any integration that ships an MCP server (GitHub, Linear, Sentry, Postgres,
|
|
4
|
+
* filesystem, …) on request, rather than each needing a bespoke tool. MCP is
|
|
5
|
+
* the standard way to "add all the integrations an agent might use".
|
|
6
|
+
*
|
|
7
|
+
* list — configured MCP servers (from ~/.lisa/mcp.json)
|
|
8
|
+
* add — add a server (name + command [+ args/env]); connects on next start
|
|
9
|
+
* remove — remove a server
|
|
10
|
+
*
|
|
11
|
+
* Servers connect at startup, so add/remove take effect after a restart
|
|
12
|
+
* (`lisa serve --web`). Their tools then appear in LISA's toolset automatically.
|
|
13
|
+
*/
|
|
14
|
+
import type { ToolDefinition } from "../types.js";
|
|
15
|
+
interface McpInput {
|
|
16
|
+
action: "list" | "add" | "remove";
|
|
17
|
+
name?: string;
|
|
18
|
+
/** For add: the server command, e.g. "npx". */
|
|
19
|
+
command?: string;
|
|
20
|
+
/** For add: command args, e.g. ["-y","@modelcontextprotocol/server-filesystem","/path"]. */
|
|
21
|
+
args?: string[];
|
|
22
|
+
/** For add: env vars the server needs (e.g. API tokens). */
|
|
23
|
+
env?: Record<string, string>;
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const mcpTool: ToolDefinition<McpInput, string>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/tools/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,UAAU,QAAQ;IAChB,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,4DAA4D;IAC5D,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,QAAQ,EAAE,MAAM,CA0DpD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { loadMcpConfig, saveMcpServer, deleteMcpServer, MCP_CONFIG_PATH } from "../mcp/config.js";
|
|
2
|
+
export const mcpTool = {
|
|
3
|
+
name: "mcp",
|
|
4
|
+
description: "Manage MCP server connections — the standard way to add external integrations (GitHub, Linear, " +
|
|
5
|
+
"Sentry, Postgres, filesystem, …) whose tools then appear in LISA's toolset. action:'list' shows " +
|
|
6
|
+
"configured servers; 'add' (name + command [+ args/env]) adds one; 'remove' (name) deletes one. " +
|
|
7
|
+
"Servers connect at startup, so add/remove take effect after restarting `lisa serve --web`. Use " +
|
|
8
|
+
"when the user wants to connect a new integration via its MCP server.",
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
action: { type: "string", enum: ["list", "add", "remove"] },
|
|
13
|
+
name: { type: "string", description: "Server name (for add/remove)." },
|
|
14
|
+
command: { type: "string", description: "Executable for add, e.g. 'npx'." },
|
|
15
|
+
args: { type: "array", items: { type: "string" }, description: "Args for add, e.g. ['-y','@scope/server-x']." },
|
|
16
|
+
env: { type: "object", additionalProperties: { type: "string" }, description: "Env vars the server needs (e.g. API tokens)." },
|
|
17
|
+
enabled: { type: "boolean", description: "Whether the server is enabled (default true)." },
|
|
18
|
+
},
|
|
19
|
+
required: ["action"],
|
|
20
|
+
additionalProperties: false,
|
|
21
|
+
},
|
|
22
|
+
async execute(input) {
|
|
23
|
+
if (input.action === "list") {
|
|
24
|
+
const servers = await loadMcpConfig();
|
|
25
|
+
if (servers.length === 0) {
|
|
26
|
+
return `(no MCP servers configured — add one with mcp action:'add', or edit ${MCP_CONFIG_PATH})`;
|
|
27
|
+
}
|
|
28
|
+
return (`${servers.length} MCP server(s) in ${MCP_CONFIG_PATH}:\n` +
|
|
29
|
+
servers
|
|
30
|
+
.map((s) => ` ${s.name}${s.enabled === false ? " (disabled)" : ""}: ${s.command} ${(s.args ?? []).join(" ")}`.trimEnd())
|
|
31
|
+
.join("\n"));
|
|
32
|
+
}
|
|
33
|
+
if (input.action === "remove") {
|
|
34
|
+
if (!input.name)
|
|
35
|
+
return "(remove needs a name — from mcp action:'list')";
|
|
36
|
+
const ok = await deleteMcpServer(input.name);
|
|
37
|
+
return ok
|
|
38
|
+
? `Removed MCP server "${input.name}". Restart \`lisa serve --web\` for it to disconnect.`
|
|
39
|
+
: `(no MCP server named "${input.name}")`;
|
|
40
|
+
}
|
|
41
|
+
// add
|
|
42
|
+
if (!input.name || !input.command) {
|
|
43
|
+
return "(add needs a name and a command, e.g. name:'filesystem' command:'npx' args:['-y','@modelcontextprotocol/server-filesystem','/path'])";
|
|
44
|
+
}
|
|
45
|
+
await saveMcpServer(input.name, {
|
|
46
|
+
command: input.command,
|
|
47
|
+
args: input.args ?? [],
|
|
48
|
+
env: input.env,
|
|
49
|
+
enabled: input.enabled ?? true,
|
|
50
|
+
});
|
|
51
|
+
return (`Added MCP server "${input.name}": ${input.command} ${(input.args ?? []).join(" ")}`.trimEnd() +
|
|
52
|
+
`\nRestart \`lisa serve --web\` to connect it — its tools then appear in my toolset automatically.`);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/tools/mcp.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAclG,MAAM,CAAC,MAAM,OAAO,GAAqC;IACvD,IAAI,EAAE,KAAK;IACX,WAAW,EACT,iGAAiG;QACjG,kGAAkG;QAClG,iGAAiG;QACjG,iGAAiG;QACjG,sEAAsE;IACxE,WAAW,EAAE;QACX,IAAI,EAAE,QAA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,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;qBACxH,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;QACJ,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC9B,IAAI,CAAC,KAAK,CAAC,IAAI;gBAAE,OAAO,gDAAgD,CAAC;YACzE,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC7C,OAAO,EAAE;gBACP,CAAC,CAAC,uBAAuB,KAAK,CAAC,IAAI,uDAAuD;gBAC1F,CAAC,CAAC,yBAAyB,KAAK,CAAC,IAAI,IAAI,CAAC;QAC9C,CAAC;QAED,MAAM;QACN,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAClC,OAAO,sIAAsI,CAAC;QAChJ,CAAC;QACD,MAAM,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE;YAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE;YACtB,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI;SAC/B,CAAC,CAAC;QACH,OAAO,CACL,qBAAqB,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE;YAC9F,mGAAmG,CACpG,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* npm_info (integration) — the npm registry, the external service every JS
|
|
3
|
+
* agent touches. view a package's metadata, find outdated deps in a repo, or
|
|
4
|
+
* audit it for known vulnerabilities. No auth; uses the local npm CLI.
|
|
5
|
+
*/
|
|
6
|
+
import type { ToolDefinition } from "../types.js";
|
|
7
|
+
interface NpmInput {
|
|
8
|
+
action: "view" | "outdated" | "audit";
|
|
9
|
+
/** Package name for view (optionally name@range). */
|
|
10
|
+
package?: string;
|
|
11
|
+
cwd?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Pure: format `npm view --json` metadata. Exported for tests. */
|
|
14
|
+
export declare function formatView(json: string): string;
|
|
15
|
+
/** Pure: format `npm outdated --json`. Exported for tests. */
|
|
16
|
+
export declare function formatOutdated(json: string): string;
|
|
17
|
+
/** Pure: summarise `npm audit --json` (npm v7+ shape). Exported for tests. */
|
|
18
|
+
export declare function formatAudit(json: string): string;
|
|
19
|
+
export declare const npmInfoTool: ToolDefinition<NpmInput, string>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=npm_info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm_info.d.ts","sourceRoot":"","sources":["../../src/tools/npm_info.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,UAAU,QAAQ;IAChB,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IACtC,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa/C;AAED,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMnD;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAShD;AAED,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,QAAQ,EAAE,MAAM,CA2CxD,CAAC"}
|