@lore-co/cli 0.2.23 → 0.2.24

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 (59) hide show
  1. package/README.md +57 -9
  2. package/dist/ask.d.ts +2 -6
  3. package/dist/ask.d.ts.map +1 -1
  4. package/dist/ask.js +4 -21
  5. package/dist/ask.js.map +1 -1
  6. package/dist/chat.d.ts +15 -0
  7. package/dist/chat.d.ts.map +1 -0
  8. package/dist/chat.js +286 -0
  9. package/dist/chat.js.map +1 -0
  10. package/dist/cli.d.ts +59 -10
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +419 -97
  13. package/dist/cli.js.map +1 -1
  14. package/dist/command-help.d.ts +3 -1
  15. package/dist/command-help.d.ts.map +1 -1
  16. package/dist/command-help.js +5 -0
  17. package/dist/command-help.js.map +1 -1
  18. package/dist/devin-capture.d.ts +6 -0
  19. package/dist/devin-capture.d.ts.map +1 -1
  20. package/dist/devin-capture.js +34 -3
  21. package/dist/devin-capture.js.map +1 -1
  22. package/dist/devin-cli.d.ts +7 -2
  23. package/dist/devin-cli.d.ts.map +1 -1
  24. package/dist/devin-cli.js +81 -8
  25. package/dist/devin-cli.js.map +1 -1
  26. package/dist/generated-assets.d.ts +8 -6
  27. package/dist/generated-assets.d.ts.map +1 -1
  28. package/dist/generated-assets.js +8 -6
  29. package/dist/generated-assets.js.map +1 -1
  30. package/dist/generic-mcp.d.ts +35 -0
  31. package/dist/generic-mcp.d.ts.map +1 -0
  32. package/dist/generic-mcp.js +83 -0
  33. package/dist/generic-mcp.js.map +1 -0
  34. package/dist/lore-agent.d.ts +50 -0
  35. package/dist/lore-agent.d.ts.map +1 -0
  36. package/dist/lore-agent.js +299 -0
  37. package/dist/lore-agent.js.map +1 -0
  38. package/dist/mcp-config.d.ts +21 -4
  39. package/dist/mcp-config.d.ts.map +1 -1
  40. package/dist/mcp-config.js +66 -6
  41. package/dist/mcp-config.js.map +1 -1
  42. package/dist/owned-files.d.ts +21 -0
  43. package/dist/owned-files.d.ts.map +1 -0
  44. package/dist/owned-files.js +88 -0
  45. package/dist/owned-files.js.map +1 -0
  46. package/dist/recovery-cloud.d.ts +1 -1
  47. package/dist/runtime.d.ts.map +1 -1
  48. package/dist/runtime.js +50 -19
  49. package/dist/runtime.js.map +1 -1
  50. package/dist/self-host.d.ts +1 -1
  51. package/dist/self-host.js +2 -2
  52. package/dist/skills.d.ts +2 -0
  53. package/dist/skills.d.ts.map +1 -1
  54. package/dist/skills.js +46 -97
  55. package/dist/skills.js.map +1 -1
  56. package/dist/update.d.ts.map +1 -1
  57. package/dist/update.js +7 -4
  58. package/dist/update.js.map +1 -1
  59. package/package.json +6 -5
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Lore as a defined agent inside a coding harness: a fresh context, a
3
+ * Lore-only prompt, and only the Lore tools plus read-only file access, so a
4
+ * person can delegate recall, proposal review, or a recap without the main
5
+ * agent's task influencing the result. One prompt source
6
+ * (integrations/agents/lore/AGENT.md) is rendered per harness here: markdown
7
+ * with frontmatter for most hosts, a TOML custom agent for Codex.
8
+ */
9
+ export type LoreAgentHarness = "claude" | "codex" | "copilot" | "cursor" | "opencode";
10
+ interface AgentPaths {
11
+ home: string;
12
+ loreDirectory: string;
13
+ }
14
+ interface Installation {
15
+ agent: string;
16
+ configPath: string;
17
+ }
18
+ /** Lore MCP tools the agent may use, in the order the harness lists them. */
19
+ export declare const LORE_AGENT_TOOLS: readonly ["ask_lore", "search_learnings", "get_learning", "list_learnings", "list_sessions", "list_proposals", "get_proposal", "decide_proposal", "remember_learning", "correct_learning", "share_lore", "list_skills", "read_skill"];
20
+ /** Skills the agent builds on; preloaded where the harness supports it. */
21
+ export declare const LORE_AGENT_SKILLS: readonly ["lore", "recap"];
22
+ interface AgentSource {
23
+ name: string;
24
+ description: string;
25
+ body: string;
26
+ }
27
+ export declare function parseLoreAgentSource(asset?: string): AgentSource;
28
+ /**
29
+ * The agent body as a TOML multi-line basic string. Only a backslash and a
30
+ * run of three quotes have meaning inside `"""`: the backslash starts an
31
+ * escape or a line-ending continuation, and three quotes end the string. One
32
+ * escaped quote breaks each such run, and the final newline keeps the closing
33
+ * delimiter away from a trailing quote, which TOML limits to two.
34
+ */
35
+ export declare function tomlMultilineString(value: string): string;
36
+ /** The complete agent file for one harness. */
37
+ export declare function renderLoreAgent(harness: LoreAgentHarness, asset?: string): string;
38
+ export interface LoreAgentFile {
39
+ harness: LoreAgentHarness;
40
+ file: string;
41
+ }
42
+ /** Where each connected agent loads a user-level agent definition from. */
43
+ export declare function loreAgentFiles(installations: readonly Installation[]): LoreAgentFile[];
44
+ export declare function installLoreAgent(paths: AgentPaths, installations: readonly Installation[]): Promise<{
45
+ files: string[];
46
+ warnings: string[];
47
+ }>;
48
+ export declare function removeLoreAgent(paths: AgentPaths, installations: readonly Installation[]): Promise<void>;
49
+ export {};
50
+ //# sourceMappingURL=lore-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lore-agent.d.ts","sourceRoot":"","sources":["../src/lore-agent.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEtF,UAAU,UAAU;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE;AAC5D,UAAU,YAAY;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE;AAE5D,6EAA6E;AAC7E,eAAO,MAAM,gBAAgB,uOAcnB,CAAC;AAEX,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,4BAA6B,CAAC;AAE5D,UAAU,WAAW;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAEzE,wBAAgB,oBAAoB,CAAC,KAAK,GAAE,MAAyB,GAAG,WAAW,CASlF;AAMD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGzD;AAuFD,+CAA+C;AAC/C,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,GAAE,MAAyB,GAAG,MAAM,CAmFnG;AAED,MAAM,WAAW,aAAa;IAAG,OAAO,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAE1E,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,GAAG,aAAa,EAAE,CAmBtF;AAKD,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAgClJ;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ9G"}
@@ -0,0 +1,299 @@
1
+ import { rm } from "node:fs/promises";
2
+ import { dirname, resolve } from "node:path";
3
+ import { LORE_AGENT_ASSET } from "./generated-assets.js";
4
+ import { atomicWrite, digest, ownedFileHint, readIfPresent, readOwnedManifest, regularPath, removeOwnedFile } from "./owned-files.js";
5
+ /** Lore MCP tools the agent may use, in the order the harness lists them. */
6
+ export const LORE_AGENT_TOOLS = [
7
+ "ask_lore",
8
+ "search_learnings",
9
+ "get_learning",
10
+ "list_learnings",
11
+ "list_sessions",
12
+ "list_proposals",
13
+ "get_proposal",
14
+ "decide_proposal",
15
+ "remember_learning",
16
+ "correct_learning",
17
+ "share_lore",
18
+ "list_skills",
19
+ "read_skill",
20
+ ];
21
+ /** Skills the agent builds on; preloaded where the harness supports it. */
22
+ export const LORE_AGENT_SKILLS = ["lore", "recap"];
23
+ export function parseLoreAgentSource(asset = LORE_AGENT_ASSET) {
24
+ const match = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/u.exec(asset);
25
+ if (match === null)
26
+ throw new Error("The Lore agent source has no frontmatter");
27
+ const fields = Object.fromEntries(match[1].split("\n").map(line => {
28
+ const separator = line.indexOf(":");
29
+ return [line.slice(0, separator).trim(), line.slice(separator + 1).trim()];
30
+ }));
31
+ if (!fields.name || !fields.description)
32
+ throw new Error("The Lore agent source needs a name and a description");
33
+ return { name: fields.name, description: fields.description, body: match[2].trim() };
34
+ }
35
+ const yamlString = (value) => JSON.stringify(value);
36
+ // JSON escapes are a subset of TOML basic-string escapes, so one quoted line serves both.
37
+ const tomlString = yamlString;
38
+ /**
39
+ * The agent body as a TOML multi-line basic string. Only a backslash and a
40
+ * run of three quotes have meaning inside `"""`: the backslash starts an
41
+ * escape or a line-ending continuation, and three quotes end the string. One
42
+ * escaped quote breaks each such run, and the final newline keeps the closing
43
+ * delimiter away from a trailing quote, which TOML limits to two.
44
+ */
45
+ export function tomlMultilineString(value) {
46
+ const escaped = value.replace(/\\/gu, "\\\\").replace(/"""/gu, '""\\"');
47
+ return `"""\n${escaped.endsWith("\n") ? escaped : `${escaped}\n`}"""`;
48
+ }
49
+ const HOST_NOTES = {
50
+ claude: `## Host notes: Claude Code
51
+
52
+ Delegate with "use the lore agent to …" or an @lore mention; Claude Code also
53
+ delegates on its own when a request matches this agent's description. The
54
+ main agent passes the session to recap when it knows it. Claude Code stores
55
+ this project's transcripts as JSONL under
56
+ \`~/.claude/projects/<project-slug>/<session-id>.jsonl\`, where the slug is the
57
+ working directory path with each \`/\` replaced by \`-\`. Without a session ID,
58
+ take the most recently modified transcript in that folder and confirm with the
59
+ person that its first user message is the session they mean. Read only
60
+ \`user\` and \`assistant\` entries. The \`lore\` and \`recap\` skills are preloaded
61
+ when they are installed; their rules apply unchanged.
62
+
63
+ This definition grants Read, Glob, and Grep for evidence and the Lore tools
64
+ listed above by name. A listed tool that your Lore connection does not offer
65
+ yet is simply absent; say so rather than substituting another route.`,
66
+ codex: `## Host notes: Codex
67
+
68
+ Ask Codex to delegate to you: "use the lore agent to …" or "have the lore
69
+ agent review my pending learnings". Codex also delegates when AGENTS.md or a
70
+ skill asks it to. In the CLI, \`/subagents\` switches between running agent
71
+ threads and shows this one; it does not start an agent by itself. This file
72
+ turns off the shell tool, apps, plugins, memories, and the permission-request
73
+ tool. It cannot restrict MCP servers, which Codex inherits from the parent
74
+ session, and it cannot create a read-only sandbox: you run under the parent's
75
+ sandbox and approval policy. So the rule in this prompt is the only limit: use
76
+ the Lore tools named above from the \`lore\` MCP server and nothing from any
77
+ other server, and make no file edits even when the sandbox would allow them.
78
+ Codex does not list MCP tools as plain functions: they are reachable through
79
+ the \`exec\` code-mode tool as \`await tools.mcp__lore__<tool>({ … })\` (list
80
+ them with \`ALL_TOOLS\`), and \`tool_search\` can answer "unsupported call".
81
+ Use \`exec\` only to call the Lore tools named above, never to run shell
82
+ commands or change files; \`apply_patch\` and \`web.run\` stay exposed and are
83
+ not yours to use.
84
+ Codex keeps sessions in its own store rather than transcript files; recap from
85
+ the conversation the person shares, from what Lore recorded (\`list_sessions\`),
86
+ and from the repository's files. Skills inherit from the parent session; the
87
+ \`lore\` and \`recap\` skills, when installed under \`~/.agents/skills\`,
88
+ describe the flows you follow.`,
89
+ copilot: `## Host notes: GitHub Copilot
90
+
91
+ Select this agent with \`/agent\` in Copilot CLI, start a session with
92
+ \`copilot --agent lore\`, pick it in VS Code's agent picker, or say "use the
93
+ lore agent to …". The \`tools\` list limits you to read, search, and the Lore
94
+ tools named above; Copilot ignores names its MCP configuration does not
95
+ provide, so when a Lore tool is missing, say so rather than substituting
96
+ another route. Copilot keeps session logs in its own format rather than a
97
+ transcript you should read; recap from what the person shares, from what Lore
98
+ recorded (\`list_sessions\`), and from the repository's files. The \`lore\` and
99
+ \`recap\` skills, when installed, describe the flows you follow.`,
100
+ opencode: `## Host notes: OpenCode
101
+
102
+ Mention \`@lore\` in a message in the TUI to run this agent in a child session,
103
+ switch to it as the primary agent with Tab, or run
104
+ \`opencode run --agent lore "…"\` from a shell; \`opencode run\` treats an
105
+ \`@lore\` mention as plain text, so the main agent answers itself there. The
106
+ permission map denies edit, bash, web, task, and the to-do tools and allows
107
+ the Lore tools above by name; OpenCode cannot deny
108
+ tools from MCP servers this definition does not know about, so do not use
109
+ another server's tools even when they are listed. OpenCode keeps sessions in
110
+ its own store rather than transcript files; recap from the conversation the
111
+ person shares, from what Lore recorded (\`list_sessions\`), and from the
112
+ repository's files. The \`lore\` and \`recap\` skills, when installed, describe
113
+ the flows you follow.`,
114
+ cursor: `## Host notes: Cursor
115
+
116
+ Run this subagent with \`/lore …\` or "use the lore subagent to …"; Cursor also
117
+ delegates on its own when a request matches this subagent's description. This
118
+ file sets no \`readonly\` flag on purpose: Cursor runs a read-only subagent in
119
+ Ask mode, which rejects every MCP call, including the read-only Lore tools, so
120
+ a read-only Lore subagent cannot answer at all. Cursor has no per-subagent tool
121
+ list and subagents inherit every tool of the parent, including every MCP
122
+ server, so the rule in this prompt is the only limit: use the Lore tools named
123
+ above from the \`lore\` MCP server and nothing from any other server, edit no
124
+ file, and run no shell command even when a read-only one would be allowed. The
125
+ parent's permission allowlist (\`Mcp(lore:<tool>)\` entries in \`.cursor/cli.json\`
126
+ or \`~/.cursor/cli-config.json\`) still decides which Lore tools run without a
127
+ prompt. The \`lore-native\` server is Cursor's capture bridge for the main
128
+ agent, not a tool for you. Cursor keeps conversations in its own store rather
129
+ than transcript files; recap from the conversation the person shares, from
130
+ what Lore recorded (\`list_sessions\`), and from the repository's files. The
131
+ \`lore\` and \`recap\` skills, when installed, describe the flows you follow.`,
132
+ };
133
+ /** The complete agent file for one harness. */
134
+ export function renderLoreAgent(harness, asset = LORE_AGENT_ASSET) {
135
+ const source = parseLoreAgentSource(asset);
136
+ const body = `${source.body}\n\n${HOST_NOTES[harness]}\n`;
137
+ switch (harness) {
138
+ case "claude":
139
+ return [
140
+ "---",
141
+ `name: ${source.name}`,
142
+ `description: ${yamlString(source.description)}`,
143
+ `tools: Read, Glob, Grep, ${LORE_AGENT_TOOLS.map(tool => `mcp__lore__${tool}`).join(", ")}`,
144
+ "skills:",
145
+ ...LORE_AGENT_SKILLS.map(skill => ` - ${skill}`),
146
+ "---",
147
+ "",
148
+ body,
149
+ ].join("\n");
150
+ case "codex":
151
+ // Codex: a standalone TOML custom agent; `model` is left out so it inherits the parent's.
152
+ // sandbox_mode, approval_policy, and mcp_servers cannot be set here, so the prompt limits the tools.
153
+ return [
154
+ `name = ${tomlString(source.name)}`,
155
+ `description = ${tomlString(source.description)}`,
156
+ `developer_instructions = ${tomlMultilineString(body)}`,
157
+ "",
158
+ "[features]",
159
+ "shell_tool = false",
160
+ "apps = false",
161
+ "plugins = false",
162
+ "memories = false",
163
+ "request_permissions_tool = false",
164
+ "",
165
+ ].join("\n");
166
+ case "copilot":
167
+ return [
168
+ "---",
169
+ `name: ${source.name}`,
170
+ `description: ${yamlString(source.description)}`,
171
+ `tools: [${["read", "search", ...LORE_AGENT_TOOLS.map(tool => `lore/${tool}`)].map(yamlString).join(", ")}]`,
172
+ "---",
173
+ "",
174
+ body,
175
+ ].join("\n");
176
+ case "cursor":
177
+ // Cursor documents name, description, model, readonly, and is_background; no tool or MCP allowlist.
178
+ // `readonly: true` is left out: it runs the subagent in Ask mode, which rejects every MCP call,
179
+ // so the Lore tools would be unreachable (verified against cursor-agent 2026.09.02).
180
+ return [
181
+ "---",
182
+ `name: ${source.name}`,
183
+ `description: ${yamlString(source.description)}`,
184
+ "model: inherit",
185
+ "---",
186
+ "",
187
+ body,
188
+ ].join("\n");
189
+ case "opencode":
190
+ return [
191
+ "---",
192
+ `description: ${yamlString(source.description)}`,
193
+ "mode: all",
194
+ "permission:",
195
+ " read: allow",
196
+ " glob: allow",
197
+ " grep: allow",
198
+ " list: allow",
199
+ " skill: allow",
200
+ " external_directory: ask",
201
+ " edit: deny",
202
+ " bash: deny",
203
+ " webfetch: deny",
204
+ " websearch: deny",
205
+ " task: deny",
206
+ // OpenCode's to-do list tools are offered unless denied; the agent has no plan to track.
207
+ " todowrite: deny",
208
+ " todoread: deny",
209
+ // Last matching rule wins: deny the server, then allow the listed tools.
210
+ ' "lore_*": deny',
211
+ ...LORE_AGENT_TOOLS.map(tool => ` lore_${tool}: allow`),
212
+ "---",
213
+ "",
214
+ body,
215
+ ].join("\n");
216
+ }
217
+ }
218
+ /** Where each connected agent loads a user-level agent definition from. */
219
+ export function loreAgentFiles(installations) {
220
+ const seen = new Set();
221
+ const files = [];
222
+ for (const installation of installations) {
223
+ const configDirectory = dirname(resolve(installation.configPath));
224
+ let entry = null;
225
+ // Claude Code: `agents/` beside the settings file, so a custom CLAUDE_CONFIG_DIR is honored.
226
+ if (installation.agent === "claude")
227
+ entry = { harness: "claude", file: resolve(configDirectory, "agents/lore.md") };
228
+ // Codex: `~/.codex/agents/<name>.toml` beside hooks.json; the `name` field, not the filename, identifies the agent.
229
+ else if (installation.agent === "codex")
230
+ entry = { harness: "codex", file: resolve(configDirectory, "agents/lore.toml") };
231
+ // Copilot: `hooks/lore.json` lives under the Copilot home (CLI) or `.github` (VS Code); agents sit beside hooks.
232
+ else if (installation.agent === "copilot-cli" || installation.agent === "copilot-vscode")
233
+ entry = { harness: "copilot", file: resolve(dirname(configDirectory), "agents/lore.agent.md") };
234
+ // Cursor: `~/.cursor/agents/` beside hooks.json; it wins over `~/.claude/agents/lore.md`, which Cursor also reads.
235
+ else if (installation.agent === "cursor")
236
+ entry = { harness: "cursor", file: resolve(configDirectory, "agents/lore.md") };
237
+ // OpenCode: `agents/` beside opencode.json.
238
+ else if (installation.agent === "opencode")
239
+ entry = { harness: "opencode", file: resolve(configDirectory, "agents/lore.md") };
240
+ if (entry !== null && !seen.has(entry.file)) {
241
+ seen.add(entry.file);
242
+ files.push(entry);
243
+ }
244
+ }
245
+ return files;
246
+ }
247
+ const manifestFile = (paths) => resolve(paths.loreDirectory, "agents.json");
248
+ const hint = (subject, file, error) => ownedFileHint(subject, file, error, "Lore still works through the skill and hooks without the agent.");
249
+ export async function installLoreAgent(paths, installations) {
250
+ const files = [], warnings = [];
251
+ let manifest;
252
+ try {
253
+ manifest = await readOwnedManifest(manifestFile(paths), "Agent");
254
+ }
255
+ catch (error) {
256
+ warnings.push(hint("Lore agent not installed: cannot read", manifestFile(paths), error));
257
+ return { files, warnings };
258
+ }
259
+ // Best-effort per file, like skills: an unwritable agent directory must not fail the connection.
260
+ for (const { harness, file } of loreAgentFiles(installations)) {
261
+ const text = renderLoreAgent(harness);
262
+ try {
263
+ if (!await regularPath(file)) {
264
+ warnings.push(`Lore agent left unchanged because its path is symlinked: ${file}`);
265
+ continue;
266
+ }
267
+ const existing = await readIfPresent(file);
268
+ if (existing !== null && existing !== text && digest(existing) !== manifest[file]) {
269
+ warnings.push(`Lore agent left unchanged to preserve your edits: ${file}`);
270
+ continue;
271
+ }
272
+ if (existing !== text)
273
+ await atomicWrite(file, text);
274
+ manifest[file] = digest(text);
275
+ files.push(file);
276
+ }
277
+ catch (error) {
278
+ warnings.push(hint("Lore agent not installed at", file, error));
279
+ }
280
+ }
281
+ try {
282
+ await atomicWrite(manifestFile(paths), `${JSON.stringify(manifest, null, 2)}\n`);
283
+ }
284
+ catch (error) {
285
+ warnings.push(hint("Lore agent ownership not recorded in", manifestFile(paths), error));
286
+ }
287
+ return { files, warnings };
288
+ }
289
+ export async function removeLoreAgent(paths, installations) {
290
+ const manifest = await readOwnedManifest(manifestFile(paths), "Agent").catch(() => ({}));
291
+ // Manifest entries never select deletion targets; only known agent locations do.
292
+ for (const { file } of loreAgentFiles(installations)) {
293
+ // The agents directory is shared with the customer's own agents; keep it.
294
+ await removeOwnedFile(file, manifest, false);
295
+ }
296
+ if (await regularPath(manifestFile(paths)))
297
+ await rm(manifestFile(paths), { force: true });
298
+ }
299
+ //# sourceMappingURL=lore-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lore-agent.js","sour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C,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7F,CAAC"}
@@ -5,19 +5,36 @@
5
5
  * decide", "share this", and "make this repeatable".
6
6
  */
7
7
  export declare const LORE_MCP_SERVER_NAME = "lore";
8
- /** Agents whose hooks are paired with the Lore MCP server. */
9
- export declare const MCP_HOST_AGENTS: readonly ["claude", "codex", "cursor"];
8
+ /** Agents whose hooks or plugin are paired with the Lore MCP server. */
9
+ export declare const MCP_HOST_AGENTS: readonly ["claude", "codex", "cursor", "copilot-cli", "copilot-vscode"];
10
10
  export type McpHostAgent = (typeof MCP_HOST_AGENTS)[number];
11
+ /** Every host that runs the Lore MCP server; OpenCode registers it beside its plugin. */
12
+ export type LoreMcpAgent = McpHostAgent | "opencode";
11
13
  /**
12
14
  * Build the server entry. `invocation` is the executable plus any script path
13
15
  * the CLI needs (empty for the standalone binary); the stored home keeps the
14
- * server on the same credentials and folder rules as the hooks.
16
+ * server on the same credentials and folder rules as the hooks, and the host
17
+ * name attributes saves whose caller passes no `agent`.
15
18
  */
16
- export declare function loreMcpServerEntry(invocation: readonly string[], home: string): Record<string, unknown>;
19
+ export declare function loreMcpServerEntry(invocation: readonly string[], home: string, agent: LoreMcpAgent): Record<string, unknown>;
17
20
  export declare function isLoreMcpServer(value: unknown): boolean;
18
21
  /** Merge the entry into a JSON host config that lists servers under `mcpServers`. */
19
22
  export declare function mergeLoreMcpServers(config: Record<string, unknown>, entry: Record<string, unknown>, agent: string): Record<string, unknown>;
20
23
  export declare function removeLoreMcpServers(config: Record<string, unknown>): Record<string, unknown>;
24
+ /**
25
+ * VS Code reads `.vscode/mcp.json` in the repository, with servers under
26
+ * `servers` in the same stdio shape (type, command, args, env) the shared
27
+ * entry already has, so the entry is stored as built.
28
+ */
29
+ export declare function mergeLoreVsCodeMcp(config: Record<string, unknown>, entry: Record<string, unknown>): Record<string, unknown>;
30
+ export declare function removeLoreVsCodeMcp(config: Record<string, unknown>): Record<string, unknown>;
31
+ /** The Lore entry in a VS Code `servers` map, or undefined when the map holds none. */
32
+ export declare function loreVsCodeMcpServer(config: unknown): unknown;
33
+ /** OpenCode lists servers under `mcp`, with the executable and arguments as one array. */
34
+ export declare function openCodeMcpEntry(entry: Record<string, unknown>): Record<string, unknown>;
35
+ export declare function isLoreOpenCodeMcp(value: unknown): boolean;
36
+ export declare function mergeLoreOpenCodeMcp(config: Record<string, unknown>, entry: Record<string, unknown>): Record<string, unknown>;
37
+ export declare function removeLoreOpenCodeMcp(config: Record<string, unknown>): Record<string, unknown>;
21
38
  /** Add or refresh the Lore block without rewriting the rest of the user's file. */
22
39
  export declare function mergeLoreCodexMcp(text: string, entry: Record<string, unknown>): string;
23
40
  export declare function removeLoreCodexMcp(text: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-config.d.ts","sourceRoot":"","sources":["../src/mcp-config.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,SAAS,CAAC;AAE3C,8DAA8D;AAC9D,eAAO,MAAM,eAAe,wCAAyC,CAAC;AACtE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAiB5D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWvG;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGvD;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,MAAM,GACZ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC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EAAE,MAAM,GAAG,MAAM,CAKvD;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAKnC"}
@@ -6,8 +6,8 @@ import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
6
6
  * decide", "share this", and "make this repeatable".
7
7
  */
8
8
  export const LORE_MCP_SERVER_NAME = "lore";
9
- /** Agents whose hooks are paired with the Lore MCP server. */
10
- export const MCP_HOST_AGENTS = ["claude", "codex", "cursor"];
9
+ /** Agents whose hooks or plugin are paired with the Lore MCP server. */
10
+ export const MCP_HOST_AGENTS = ["claude", "codex", "cursor", "copilot-cli", "copilot-vscode"];
11
11
  const CODEX_MCP_START = "# >>> Lore MCP server >>>";
12
12
  const CODEX_MCP_END = "# <<< Lore MCP server <<<";
13
13
  function isObject(value) {
@@ -24,20 +24,25 @@ function stableJson(value) {
24
24
  /**
25
25
  * Build the server entry. `invocation` is the executable plus any script path
26
26
  * the CLI needs (empty for the standalone binary); the stored home keeps the
27
- * server on the same credentials and folder rules as the hooks.
27
+ * server on the same credentials and folder rules as the hooks, and the host
28
+ * name attributes saves whose caller passes no `agent`.
28
29
  */
29
- export function loreMcpServerEntry(invocation, home) {
30
+ export function loreMcpServerEntry(invocation, home, agent) {
30
31
  const [command, ...prefix] = invocation;
31
32
  if (command === undefined)
32
33
  throw new Error("The Lore MCP server needs an executable");
33
- return {
34
+ const entry = {
34
35
  type: "stdio",
35
36
  command,
36
37
  args: [...prefix, "mcp", "--owner", "lore"],
37
38
  // Writes stay proposals that owners and admins approve; hooks already
38
39
  // deliver context per prompt, so the server skips its own delivery tool.
39
- env: { LORE_HOME: home, LORE_MCP_WRITE_TOOLS: "true", LORE_MCP_HOST_CONTEXT: "hooks" },
40
+ env: { LORE_HOME: home, LORE_MCP_WRITE_TOOLS: "true", LORE_MCP_HOST_CONTEXT: "hooks", LORE_MCP_AGENT: agent },
40
41
  };
42
+ // Copilot CLI calls stdio servers "local" and enables tools by name.
43
+ if (agent === "copilot-cli")
44
+ return { ...entry, type: "local", tools: ["*"] };
45
+ return entry;
41
46
  }
42
47
  export function isLoreMcpServer(value) {
43
48
  return isObject(value) && Array.isArray(value.args) && value.args.includes("mcp")
@@ -61,6 +66,61 @@ export function removeLoreMcpServers(config) {
61
66
  const { [LORE_MCP_SERVER_NAME]: _lore, ...rest } = config.mcpServers;
62
67
  return { ...config, mcpServers: rest };
63
68
  }
69
+ /**
70
+ * VS Code reads `.vscode/mcp.json` in the repository, with servers under
71
+ * `servers` in the same stdio shape (type, command, args, env) the shared
72
+ * entry already has, so the entry is stored as built.
73
+ */
74
+ export function mergeLoreVsCodeMcp(config, entry) {
75
+ if (config.servers !== undefined && !isObject(config.servers)) {
76
+ throw new Error('VS Code configuration field "servers" must be a JSON object');
77
+ }
78
+ const servers = isObject(config.servers) ? config.servers : {};
79
+ const existing = servers[LORE_MCP_SERVER_NAME];
80
+ if (existing !== undefined && !isLoreMcpServer(existing)) {
81
+ throw new Error(`VS Code MCP name "${LORE_MCP_SERVER_NAME}" is already owned by another server; rename it before connecting.`);
82
+ }
83
+ return { ...config, servers: { ...servers, [LORE_MCP_SERVER_NAME]: entry } };
84
+ }
85
+ export function removeLoreVsCodeMcp(config) {
86
+ if (!isObject(config.servers) || !isLoreMcpServer(config.servers[LORE_MCP_SERVER_NAME]))
87
+ return config;
88
+ const { [LORE_MCP_SERVER_NAME]: _lore, ...rest } = config.servers;
89
+ return { ...config, servers: rest };
90
+ }
91
+ /** The Lore entry in a VS Code `servers` map, or undefined when the map holds none. */
92
+ export function loreVsCodeMcpServer(config) {
93
+ return isObject(config) && isObject(config.servers) ? config.servers[LORE_MCP_SERVER_NAME] : undefined;
94
+ }
95
+ /** OpenCode lists servers under `mcp`, with the executable and arguments as one array. */
96
+ export function openCodeMcpEntry(entry) {
97
+ return {
98
+ type: "local",
99
+ command: [entry.command, ...(Array.isArray(entry.args) ? entry.args : [])],
100
+ environment: entry.env,
101
+ enabled: true,
102
+ };
103
+ }
104
+ export function isLoreOpenCodeMcp(value) {
105
+ return isObject(value) && Array.isArray(value.command) && value.command.includes("mcp")
106
+ && value.command.includes("--owner") && value.command.includes("lore");
107
+ }
108
+ export function mergeLoreOpenCodeMcp(config, entry) {
109
+ if (config.mcp !== undefined && !isObject(config.mcp))
110
+ throw new Error('OpenCode configuration field "mcp" must be a JSON object');
111
+ const servers = isObject(config.mcp) ? config.mcp : {};
112
+ const existing = servers[LORE_MCP_SERVER_NAME];
113
+ if (existing !== undefined && !isLoreOpenCodeMcp(existing)) {
114
+ throw new Error(`OpenCode MCP name "${LORE_MCP_SERVER_NAME}" is already owned by another server; rename it before connecting.`);
115
+ }
116
+ return { ...config, mcp: { ...servers, [LORE_MCP_SERVER_NAME]: openCodeMcpEntry(entry) } };
117
+ }
118
+ export function removeLoreOpenCodeMcp(config) {
119
+ if (!isObject(config.mcp) || !isLoreOpenCodeMcp(config.mcp[LORE_MCP_SERVER_NAME]))
120
+ return config;
121
+ const { [LORE_MCP_SERVER_NAME]: _lore, ...rest } = config.mcp;
122
+ return Object.keys(rest).length === 0 ? Object.fromEntries(Object.entries(config).filter(([key]) => key !== "mcp")) : { ...config, mcp: rest };
123
+ }
64
124
  /** Codex lists servers in TOML; it has no `type` field. */
65
125
  function codexMcpTable(entry) {
66
126
  const { type: _type, ...table } = entry;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-config.js","sourceRoot":"","sources":["../src/mcp-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE3C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAG,CAA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es into an agent's own directories (skills, agent
3
+ * definitions) and must later remove without touching the customer's edits.
4
+ * Ownership is a manifest of file path to content digest; a file is only
5
+ * rewritten or deleted while its content still matches the recorded digest.
6
+ */
7
+ export declare const digest: (text: string) => string;
8
+ export type OwnedManifest = Record<string, string>;
9
+ /** True when no component of the path is a symlink. Lore never follows links into other files. */
10
+ export declare function regularPath(path: string): Promise<boolean>;
11
+ export declare function readOwnedManifest(file: string, subject: string): Promise<OwnedManifest>;
12
+ export declare function atomicWrite(file: string, text: string): Promise<void>;
13
+ export declare function readIfPresent(file: string): Promise<string | null>;
14
+ /**
15
+ * Delete the file when the manifest owns it and its content is unchanged;
16
+ * then drop an empty parent directory and the manifest entry. Returns false
17
+ * when the file was left alone.
18
+ */
19
+ export declare function removeOwnedFile(file: string, manifest: OwnedManifest, removeEmptyDirectory?: boolean): Promise<boolean>;
20
+ export declare function ownedFileHint(subject: string, file: string, error: unknown, consequence: string): string;
21
+ //# sourceMappingURL=owned-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"owned-files.d.ts","sourceRoot":"","sources":["../src/owned-files.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,KAAG,MAAyD,CAAC;AAEhG,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD,kGAAkG;AAClG,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAWhE;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAU7F;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK3E;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKxE;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,oBAAoB,UAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAe1H;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAIxG"}