@lore-co/cli 0.2.23 → 0.2.25

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
package/README.md CHANGED
@@ -30,7 +30,7 @@ The package requires Node.js 22 or newer and installs the `lore` command.
30
30
 
31
31
  In Connect, **This project** asks your agent to confirm the current folder. **Choose another project** offers a native folder picker, GitHub selection, and manual path entry. The CLI also supports `--current-project` (interactive confirmation), `--choose-folder` (a picker on this machine), and `--repository github.com/owner/repo` alongside a folder choice to verify its Git origin. Cancelling or choosing a mismatched checkout stops setup before recording. GitHub selection does not change workspace policy.
32
32
 
33
- Run setup from the project you want to record: `--folder .` includes that folder and its subfolders. Repeat `--folder <path>` for additional folders, or choose `--all-projects` explicitly. New connections stay paused without a capture choice; reconnecting without one preserves your existing rules. Existing exclusions remain in effect. Use `lore scope check <folder>` to verify. Learning repository scope controls where knowledge applies and is separate from capture scope.
33
+ Run setup from the project you want to record: `--folder .` includes that folder and its subfolders. Repeat `--folder <path>` for additional folders, or choose `--all-projects` explicitly. New connections stay paused without a capture choice; reconnecting without one preserves your existing rules. Existing exclusions remain in effect. Add `--no-capture` (or run `lore capture off`) for retrieval-only mode: context, Guard, `lore ask`, and `lore remember` without automatic turn recording; `lore capture on` turns it back on. Use `lore scope check <folder>` to verify. Learning repository scope controls where knowledge applies and is separate from capture scope.
34
34
 
35
35
  ### Windows
36
36
 
@@ -181,6 +181,21 @@ excerpts. `--repo` and
181
181
  response. Requires a connected workspace (`lore connect`) and a server that
182
182
  exposes `POST /v1/ask`.
183
183
 
184
+ ```sh
185
+ lore chat
186
+ lore chat "Has anyone on the team run into flaky auth tests?"
187
+ lore chat "What did we decide about payment retries?" --repo acme/billing --json
188
+ ```
189
+
190
+ `chat` is a read-only discussion over the same knowledge: Lore answers in
191
+ prose, numbers the learnings and sessions it cited (with dashboard links when a
192
+ dashboard URL is configured), and says when nothing in the workspace covers a
193
+ question. In the prompt, a follow-up keeps the previous answer's sources, a
194
+ number prints that source in full, `scope <repo>` changes the repository, and
195
+ `quit` exits. Nothing typed in the chat is saved. Prose answers need a server
196
+ with `EXTRACTOR_PROVIDER=hybrid` or `openai-compatible`; a heuristic server
197
+ lists the retrieved sources instead.
198
+
184
199
  ```sh
185
200
  lore learnings
186
201
  lore learnings --repo acme/billing --json > learnings.json
@@ -218,8 +233,9 @@ optional `--reason`. `--json` prints the server records for scripts.
218
233
  Deciding needs a connection that identifies you: connect with
219
234
  `lore connect --login`, which mints a credential you approved for this machine.
220
235
  Workspace tokens created in the dashboard for integrations are refused, so an
221
- agent cannot approve its own captures, and members can read proposals but not
222
- decide them, the same rules the dashboard applies. A proposal with an open
236
+ agent cannot approve its own captures; they can still list and show proposals.
237
+ Members can read proposals but not decide them, the same rules the dashboard
238
+ applies. A proposal with an open
223
239
  conflict against an existing learning is decided in the dashboard, where the
224
240
  current learning can be replaced or kept alongside the proposal.
225
241
 
@@ -252,6 +268,36 @@ Installation paths follow the official [Codex](https://developers.openai.com/cod
252
268
  [Cursor](https://cursor.com/docs/skills), and [OpenCode](https://opencode.ai/docs/skills/)
253
269
  skill conventions.
254
270
 
271
+ ### Lore as an agent
272
+
273
+ For Claude Code, Copilot CLI, Copilot in VS Code, Cursor, and OpenCode,
274
+ `lore connect` also installs Lore as a defined agent: a separate agent with a fresh context, a
275
+ Lore-only prompt, and only the Lore tools plus read-only file access. Delegate
276
+ to it when the answer should not be shaped by the task your main agent is in:
277
+
278
+ - Claude Code: “use the lore agent to review my pending learnings”, or `@lore`.
279
+ - Codex: “use the lore agent to recap this session”; `/subagents` switches
280
+ between running agent threads.
281
+ - Copilot CLI: `/agent` → **lore**, or `copilot --agent lore`.
282
+ - Cursor: `/lore recap this session`, or “use the lore subagent to …”.
283
+ - OpenCode: `@lore recap this session`, or Tab to switch to it.
284
+
285
+ It finds prior knowledge and sessions, reviews pending proposals, recaps a
286
+ session into learnings you select, and shares links. It is not a coding agent
287
+ and reports only verified saves with their workspace and repository scope.
288
+ Files: `~/.claude/agents/lore.md`, `~/.codex/agents/lore.toml`,
289
+ `~/.copilot/agents/lore.agent.md`, `.github/agents/lore.agent.md` (VS Code),
290
+ `~/.cursor/agents/lore.md`, and `~/.config/opencode/agents/lore.md`;
291
+ `lore disconnect` removes the ones Lore wrote. Cursor can only mark the
292
+ subagent read-only, and Codex can only switch off the shell tool, apps,
293
+ plugins, memories, and permission requests (its custom agents inherit the
294
+ parent's sandbox and MCP servers,
295
+ [docs](https://learn.chatgpt.com/docs/agent-configuration/subagents)), so
296
+ there the prompt is the tool limit. Connecting Copilot CLI or
297
+ OpenCode now also registers the Lore MCP server (`~/.copilot/mcp-config.json`,
298
+ `mcp.lore` in `opencode.json`) so the agent has its tools. See
299
+ [Lore as an agent](../../docs/guides/lore-agent.md).
300
+
255
301
  ## Save knowledge manually
256
302
 
257
303
  ```sh
@@ -356,7 +402,7 @@ content-free `guard_check` audit event.
356
402
 
357
403
  ```sh
358
404
  lore update
359
- lore update --version v0.2.23
405
+ lore update --version v0.2.25
360
406
  ```
361
407
 
362
408
  `update` resolves the latest release to an exact tag, or uses the exact
@@ -519,9 +565,10 @@ command has subcommand-specific `--help`, and `up`, `down`, and `status` support
519
565
  Claude Code, Codex, and Cursor also receive the `lore` MCP server, run by this
520
566
  CLI from the same protected config. Hooks keep delivering context into each
521
567
  prompt and capturing turns; the server adds the explicit tools behind "ask Lore
522
- what we decided", "remember this", "share this", and "make this repeatable"
523
- (`ask_lore`, `search_learnings`, `remember_learning`, `share_lore`, and the
524
- approach tools). It skips `prepare_context` because the hooks already deliver
568
+ what we decided", "remember this", "let's review my pending learnings", "share
569
+ this", and "make this repeatable" (`ask_lore`, `search_learnings`,
570
+ `remember_learning`, `list_proposals`, `decide_proposal`, `share_lore`, and the
571
+ approach tools; `decide_proposal` follows the same rules as `lore review`). It skips `prepare_context` because the hooks already deliver
525
572
  context, and its saves stay proposals until an owner or admin approves them.
526
573
  Connect writes the entry to `~/.claude.json`, a marked block in
527
574
  `~/.codex/config.toml`, and `~/.cursor/mcp.json`; `lore status` reports it as
@@ -567,7 +614,8 @@ First prompts use `POST /v1/observations` and audited
567
614
  workspace bearer token and an `Idempotency-Key` header. Automatic teachings
568
615
  default to repository scope and follow the workspace learning policy. In
569
616
  `proposal_only` mode, every automatic capture remains proposed and cannot be
570
- retrieved or injected until dashboard review activates it. Rejected,
617
+ retrieved or injected until an owner or admin activates it (`lore review` or
618
+ the dashboard). Rejected,
571
619
  suppressed, superseded, and deleted learnings are also excluded. Dirty files
572
620
  and the current directory remain task relevance evidence and do not narrow
573
621
  every learning. Only an explicit correction with clear team-, company,
@@ -722,7 +770,7 @@ same-repository, non-draft pull requests bearing the corresponding
722
770
  `lore:codex-review` or `lore:devin-review` label.
723
771
 
724
772
  Generated jobs require a published standalone binary release and default to
725
- `treadiehq/lore-releases` at `v0.2.23`. Set `LORE_CLI_REPOSITORY` to the publicly
773
+ `treadiehq/lore-releases` at `v0.2.25`. Set `LORE_CLI_REPOSITORY` to the publicly
726
774
  readable `owner/repository` and `LORE_CLI_VERSION` to an existing release tag
727
775
  when using another release source.
728
776
 
package/dist/ask.d.ts CHANGED
@@ -1,10 +1,6 @@
1
+ import { repositoryScopeFromCheckout as detectRepository } from "@lore-co/core/repository-location";
1
2
  import type { ConnectorConfig } from "./cli.js";
2
- /**
3
- * The repository the capture hooks record for this folder: the origin of the
4
- * enclosing Git checkout, or none outside one. Asking from inside a repository
5
- * should rank its learnings the same way a session there does.
6
- */
7
- export declare function detectRepository(cwd: string): Promise<string | undefined>;
3
+ export { detectRepository };
8
4
  export declare function runAskCommand(args: readonly string[], config: ConnectorConfig | null, options?: {
9
5
  cwd?: string;
10
6
  }): Promise<void>;
package/dist/ask.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA+FhD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAU/E;AAqDD,wBAAsB,aAAa,CACjC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,EAAE,eAAe,GAAG,IAAI,EAC9B,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,OAAO,CAAC,IAAI,CAAC,CAiEf"}
1
+ {"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,2BAA2B,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAkJ5B,wBAAsB,aAAa,CACjC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,EAAE,eAAe,GAAG,IAAI,EAC9B,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,OAAO,CAAC,IAAI,CAAC,CAiEf"}
package/dist/ask.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AskResponseSchema, formatRetrievalExplanation, } from "@lore-co/core";
2
- import { repositoryScopeFromGitRoot } from "@lore-co/core/repository-location";
3
- import { access } from "node:fs/promises";
4
- import { dirname, resolve } from "node:path";
2
+ import { repositoryScopeFromCheckout as detectRepository } from "@lore-co/core/repository-location";
3
+ // The repository the capture hooks record for this folder, or none outside a checkout.
4
+ export { detectRepository };
5
5
  const ASK_HELP = `lore ask
6
6
  Query Lore's shared context: durable knowledge plus prior work sessions.
7
7
 
@@ -84,26 +84,9 @@ function parseAskArguments(args) {
84
84
  }
85
85
  return parsed;
86
86
  }
87
- /**
88
- * The repository the capture hooks record for this folder: the origin of the
89
- * enclosing Git checkout, or none outside one. Asking from inside a repository
90
- * should rank its learnings the same way a session there does.
91
- */
92
- export async function detectRepository(cwd) {
93
- let root = resolve(cwd);
94
- for (;;) {
95
- if (await access(resolve(root, ".git")).then(() => true, () => false)) {
96
- return repositoryScopeFromGitRoot(root);
97
- }
98
- const parent = dirname(root);
99
- if (parent === root)
100
- return undefined;
101
- root = parent;
102
- }
103
- }
104
87
  function formatRepositoryLine(repo, source) {
105
88
  if (repo === undefined) {
106
- return "Repository: none detected in this folder; showing workspace-wide knowledge only.\n";
89
+ return "Repository: none detected in this folder; searching every repository Lore is on for.\n";
107
90
  }
108
91
  return `Repository: ${repo} (${source === "flag" ? "from --repo" : "detected from the current folder"})\n`;
109
92
  }
package/dist/ask.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ask.js","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAG3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG7C,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;CAoBhB,CAAC;AAYF,SAAS,iBAAiB,CAAC,IAAuB;IAChD,MAAM,MAAM,GAAiB;QAC3B,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,IAAI;QACrB,IAAI,EAAE,K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AAC,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1E,OAAO;IACT,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,GAAG,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CACpF,CAAC;AACJ,CAAC"}
package/dist/chat.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { Readable, Writable } from "node:stream";
2
+ import { type ChatResponse, type ChatSource } from "@lore-co/core";
3
+ import type { ConnectorConfig } from "./cli.js";
4
+ export interface ChatCommandOptions {
5
+ cwd?: string;
6
+ /** Lines for the prompt; defaults to standard input. */
7
+ input?: Readable;
8
+ output?: Writable;
9
+ }
10
+ export declare function formatChatAnswer(response: ChatResponse, dashboard: URL | null): {
11
+ text: string;
12
+ sources: ChatSource[];
13
+ };
14
+ export declare function runChatCommand(args: readonly string[], config: ConnectorConfig | null, options?: ChatCommandOptions): Promise<void>;
15
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAOL,KAAK,YAAY,EACjB,KAAK,UAAU,EAEhB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA2EhD,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,MAAM,CAAC,EAAE,QAAQ,CAAC;CACnB;AAiFD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,EAAE,CAAA;CAAE,CAcvH;AAyED,wBAAsB,cAAc,CAClC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,EAAE,eAAe,GAAG,IAAI,EAC9B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAsDf"}
package/dist/chat.js ADDED
@@ -0,0 +1,286 @@
1
+ import { createInterface } from "node:readline";
2
+ import { ChatResponseSchema, GetMemoryResponseSchema, MAX_CHAT_TURNS, WorkSessionDetailResponseSchema, } from "@lore-co/core";
3
+ import { sharingDashboardUrl } from "@lore-co/sdk";
4
+ import { detectRepository } from "./ask.js";
5
+ const CHAT_HELP = `lore chat
6
+ Discuss your workspace's shared knowledge with Lore in plain language.
7
+ Read-only: nothing you type is saved, and no learning, session, approach or
8
+ share is created or changed.
9
+
10
+ Usage:
11
+ lore chat Open a prompt (type quit to leave)
12
+ lore chat "<question>" [options] Answer once and exit
13
+
14
+ Options:
15
+ --repo <repo> Rank knowledge and sessions for this repository
16
+ (default: the Git repository of the current folder)
17
+ --project <name> Rank knowledge and sessions for this project
18
+ --agent <name> Identify the calling agent (default: human)
19
+ --json One-shot mode: print the full machine-readable response
20
+ --help Show this command's help
21
+
22
+ In the prompt:
23
+ <question> Ask; follow-ups keep the previous answer's sources
24
+ <number> Print that cited learning or session in full
25
+ scope <repo> Rank for another repository (scope none for workspace-wide)
26
+ quit Leave the chat
27
+
28
+ Answers cite the learnings and sessions they drew on and say plainly when
29
+ nothing in the workspace covers a question. Servers without an AI model
30
+ (EXTRACTOR_PROVIDER=heuristic) list the retrieved sources instead of prose.
31
+
32
+ Examples:
33
+ lore chat
34
+ lore chat "Has anyone on the team run into flaky auth tests?"
35
+ lore chat "What did we decide about payment retries?" --repo acme/billing --json
36
+ `;
37
+ function parseChatArguments(args) {
38
+ const parsed = { question: "", json: false };
39
+ const positionals = [];
40
+ for (let index = 0; index < args.length; index += 1) {
41
+ const argument = args[index];
42
+ if (argument === "--help" || argument === "-h") {
43
+ process.stdout.write(CHAT_HELP);
44
+ return null;
45
+ }
46
+ if (argument === "--json") {
47
+ parsed.json = true;
48
+ continue;
49
+ }
50
+ if (argument === "--repo" || argument === "--project" || argument === "--agent") {
51
+ const value = args[index + 1];
52
+ if (value === undefined || value.startsWith("-"))
53
+ throw new Error(`Missing value for ${argument}`);
54
+ index += 1;
55
+ if (argument === "--repo")
56
+ parsed.repo = value;
57
+ else if (argument === "--project")
58
+ parsed.project = value;
59
+ else
60
+ parsed.agent = value;
61
+ continue;
62
+ }
63
+ if (argument.startsWith("--"))
64
+ throw new Error(`Unknown chat option: ${argument}`);
65
+ positionals.push(argument);
66
+ }
67
+ parsed.question = positionals.join(" ").trim();
68
+ if (parsed.json && parsed.question === "") {
69
+ throw new Error('--json needs a question. Try: lore chat "What did we decide about retries?" --json');
70
+ }
71
+ return parsed;
72
+ }
73
+ async function request(config, method, path, body) {
74
+ try {
75
+ return await fetch(`${config.apiUrl}${path}`, {
76
+ method,
77
+ headers: {
78
+ accept: "application/json",
79
+ authorization: `Bearer ${config.token}`,
80
+ ...(body === undefined ? {} : { "content-type": "application/json" }),
81
+ },
82
+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),
83
+ signal: AbortSignal.timeout(60_000),
84
+ });
85
+ }
86
+ catch {
87
+ throw new Error("Lore API is unreachable. Run lore doctor to diagnose connectivity.");
88
+ }
89
+ }
90
+ function failForStatus(response, feature) {
91
+ if (response.status === 401 || response.status === 403) {
92
+ throw new Error("Lore authentication failed. Reconnect with a valid workspace token.");
93
+ }
94
+ if (response.status === 404) {
95
+ throw new Error(`This Lore server does not support ${feature}. Upgrade the server to use lore chat.`);
96
+ }
97
+ if (response.status === 503) {
98
+ throw new Error("Lore chat is unavailable: the server's model did not answer. Try again later.");
99
+ }
100
+ if (!response.ok)
101
+ throw new Error(`Lore chat failed with HTTP ${response.status}.`);
102
+ }
103
+ async function sendMessage(session, message) {
104
+ const body = {
105
+ message,
106
+ ...(session.turns.length === 0 ? {} : { turns: session.turns.slice(-MAX_CHAT_TURNS) }),
107
+ ...(session.cited.learnings.length === 0 && session.cited.sessions.length === 0 ? {} : { cited: session.cited }),
108
+ ...(session.repo === undefined ? {} : { repo: session.repo }),
109
+ ...(session.project === undefined ? {} : { project: session.project }),
110
+ ...(session.agent === undefined ? {} : { agent: session.agent }),
111
+ };
112
+ const response = await request(session.config, "POST", "/v1/chat", body);
113
+ failForStatus(response, "chat");
114
+ const parsed = ChatResponseSchema.safeParse(JSON.parse(await response.text()));
115
+ if (!parsed.success) {
116
+ throw new Error("Lore server returned an incompatible chat response. Upgrade the server and CLI.");
117
+ }
118
+ return parsed.data;
119
+ }
120
+ function dashboardFor(config) {
121
+ try {
122
+ return sharingDashboardUrl(config.apiUrl, config.dashboardUrl);
123
+ }
124
+ catch {
125
+ return null;
126
+ }
127
+ }
128
+ function formatRepositoryLine(repo, source) {
129
+ if (repo === undefined)
130
+ return "Repository: none detected in this folder; discussing workspace-wide knowledge.";
131
+ return `Repository: ${repo} (${source === "flag" ? "from --repo" : "detected from the current folder"})`;
132
+ }
133
+ /** Cited sources first, numbered for the prompt; retrieval mode shows everything found. */
134
+ function listedSources(response) {
135
+ const cited = response.sources.filter((source) => source.cited);
136
+ return cited.length > 0 ? cited : response.mode === "retrieval" ? response.sources : [];
137
+ }
138
+ export function formatChatAnswer(response, dashboard) {
139
+ const sources = listedSources(response);
140
+ const lines = [response.answer.trimEnd()];
141
+ if (sources.length > 0) {
142
+ lines.push("", "Sources:");
143
+ for (const [index, source] of sources.entries()) {
144
+ const where = source.repo === null ? "workspace-wide" : source.repo;
145
+ const link = dashboard === null ? "" : ` ${new URL(source.path, dashboard).href}`;
146
+ lines.push(` [${index + 1}] ${source.kind} · ${source.title} · ${where}${link}`);
147
+ if (response.mode === "retrieval" && source.excerpt !== "")
148
+ lines.push(` ${source.excerpt.slice(0, 240)}`);
149
+ }
150
+ lines.push("Type a number to read a source in full.");
151
+ }
152
+ return { text: `${lines.join("\n")}\n`, sources };
153
+ }
154
+ async function printSource(session, source, write) {
155
+ const link = session.dashboard === null ? "" : `\nDashboard: ${new URL(source.path, session.dashboard).href}`;
156
+ if (source.kind === "learning") {
157
+ const response = await request(session.config, "GET", `/v1/learnings/${source.id}`);
158
+ failForStatus(response, "learnings");
159
+ const parsed = GetMemoryResponseSchema.safeParse(JSON.parse(await response.text()));
160
+ const memory = parsed.success ? parsed.data.memory : null;
161
+ if (memory === null)
162
+ throw new Error("This learning is no longer available in your workspace.");
163
+ const scope = [memory.scope.repo === undefined ? "workspace-wide" : memory.scope.repo, memory.scope.path, memory.scope.component]
164
+ .filter((value) => typeof value === "string").join(" · ");
165
+ write(`Learning ${memory.id}\n${memory.content}\n\ncategory: ${memory.category} · status: ${memory.status} · scope: ${scope} · updated ${memory.updatedAt.slice(0, 10)}${link}\n`);
166
+ return;
167
+ }
168
+ const response = await request(session.config, "GET", `/v1/sessions/${source.id}`);
169
+ failForStatus(response, "sessions");
170
+ const parsed = WorkSessionDetailResponseSchema.safeParse(JSON.parse(await response.text()));
171
+ if (!parsed.success)
172
+ throw new Error("This session is no longer available in your workspace.");
173
+ const { session: detail, events } = parsed.data;
174
+ const where = detail.repo ?? detail.project ?? "unknown repo";
175
+ const lines = [`Session ${detail.id} · ${detail.agent} · ${where} · last active ${detail.lastActivityAt.slice(0, 10)} · ${detail.eventCount} event(s)`];
176
+ if (detail.title)
177
+ lines.push(detail.title);
178
+ for (const event of events) {
179
+ const parts = [
180
+ event.task === null ? null : `task: ${event.task}`,
181
+ event.userText === null ? null : `user: ${event.userText}`,
182
+ event.assistantText === null ? null : `assistant: ${event.assistantText}`,
183
+ ].filter((value) => value !== null);
184
+ if (parts.length > 0)
185
+ lines.push("", `[${event.occurredAt.slice(0, 16).replace("T", " ")} · ${event.type}]`, ...parts);
186
+ }
187
+ write(`${lines.join("\n")}${link}\n`);
188
+ }
189
+ async function handleLine(session, raw, write) {
190
+ const line = raw.trim();
191
+ if (line === "")
192
+ return "continue";
193
+ if (line === "quit" || line === "exit")
194
+ return "quit";
195
+ if (/^\d+$/u.test(line)) {
196
+ const source = session.sources[Number(line) - 1];
197
+ if (source === undefined) {
198
+ write(session.sources.length === 0 ? "No sources to open yet. Ask a question first.\n" : `Choose a source between 1 and ${session.sources.length}.\n`);
199
+ return "continue";
200
+ }
201
+ await printSource(session, source, write);
202
+ return "continue";
203
+ }
204
+ const scope = /^scope(?:\s+(.*))?$/u.exec(line);
205
+ if (scope !== null) {
206
+ const value = scope[1]?.trim();
207
+ if (value === undefined || value === "") {
208
+ write(`${formatRepositoryLine(session.repo, session.repoSource)}\nUse: scope <owner/repo> or scope none\n`);
209
+ return "continue";
210
+ }
211
+ session.repo = value === "none" ? undefined : value;
212
+ session.repoSource = "flag";
213
+ // A new scope is a new subject: start the thread again.
214
+ session.turns = [];
215
+ session.cited = { learnings: [], sessions: [] };
216
+ session.sources = [];
217
+ write(`${session.repo === undefined ? "Repository: none; discussing workspace-wide knowledge." : `Repository: ${session.repo}`}\n`);
218
+ return "continue";
219
+ }
220
+ const response = await sendMessage(session, line);
221
+ const formatted = formatChatAnswer(response, session.dashboard);
222
+ write(formatted.text);
223
+ session.sources = formatted.sources;
224
+ session.cited = response.cited;
225
+ const exchange = [{ role: "user", content: line }, { role: "lore", content: response.answer.slice(0, 4_000) }];
226
+ session.turns = [...session.turns, ...exchange].slice(-MAX_CHAT_TURNS);
227
+ return "continue";
228
+ }
229
+ export async function runChatCommand(args, config, options = {}) {
230
+ const parsed = parseChatArguments(args);
231
+ if (parsed === null)
232
+ return;
233
+ if (config === null) {
234
+ throw new Error("Lore is not connected. Run: lore connect --token <workspace-token>");
235
+ }
236
+ const output = options.output ?? process.stdout;
237
+ const write = (text) => { output.write(text); };
238
+ const repoSource = parsed.repo === undefined ? "folder" : "flag";
239
+ const session = {
240
+ config,
241
+ repo: parsed.repo ?? (await detectRepository(options.cwd ?? process.cwd())),
242
+ repoSource,
243
+ project: parsed.project,
244
+ agent: parsed.agent,
245
+ turns: [],
246
+ cited: { learnings: [], sessions: [] },
247
+ sources: [],
248
+ dashboard: dashboardFor(config),
249
+ };
250
+ if (parsed.question !== "") {
251
+ const response = await sendMessage(session, parsed.question);
252
+ if (parsed.json) {
253
+ write(`${JSON.stringify(response, null, 2)}\n`);
254
+ return;
255
+ }
256
+ const formatted = formatChatAnswer(response, session.dashboard);
257
+ write(`${formatRepositoryLine(session.repo, session.repoSource)}\n\n${formatted.text.replace(/\nType a number to read a source in full\.\n$/u, "\n")}`);
258
+ return;
259
+ }
260
+ write(`Lore chat (read-only; nothing you type is saved)\n${formatRepositoryLine(session.repo, session.repoSource)}\nAsk a question, type a source number to read it, scope <repo> to change scope, or quit.\n\n`);
261
+ const input = options.input ?? process.stdin;
262
+ const prompt = createInterface({ input, terminal: false });
263
+ const showPrompt = () => write("lore> ");
264
+ showPrompt();
265
+ try {
266
+ for await (const line of prompt) {
267
+ let outcome;
268
+ try {
269
+ outcome = await handleLine(session, line, write);
270
+ }
271
+ catch (error) {
272
+ // One failed turn ends neither the chat nor the terminal session.
273
+ write(`${error instanceof Error ? error.message : String(error)}\n`);
274
+ outcome = "continue";
275
+ }
276
+ if (outcome === "quit")
277
+ break;
278
+ showPrompt();
279
+ }
280
+ }
281
+ finally {
282
+ prompt.close();
283
+ }
284
+ write("\n");
285
+ }
286
+ //# sourceMappingURL=chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.js","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,+BAA+B,GAMhC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5C,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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