oortmem 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +21 -2
  3. package/dist/commands/connect.d.ts +14 -0
  4. package/dist/commands/connect.js +99 -0
  5. package/dist/commands/consolidate.d.ts +3 -0
  6. package/dist/commands/consolidate.js +21 -0
  7. package/dist/commands/doctor.d.ts +15 -0
  8. package/dist/commands/doctor.js +410 -0
  9. package/dist/commands/explain.d.ts +5 -0
  10. package/dist/commands/explain.js +67 -0
  11. package/dist/commands/export.d.ts +19 -0
  12. package/dist/commands/export.js +69 -0
  13. package/dist/commands/forget.d.ts +5 -0
  14. package/dist/commands/forget.js +17 -0
  15. package/dist/commands/hook.d.ts +12 -0
  16. package/dist/commands/hook.js +165 -0
  17. package/dist/commands/import.d.ts +23 -0
  18. package/dist/commands/import.js +67 -0
  19. package/dist/commands/init.d.ts +9 -0
  20. package/dist/commands/init.js +86 -0
  21. package/dist/commands/inspect.d.ts +26 -0
  22. package/dist/commands/inspect.js +126 -0
  23. package/dist/commands/install.d.ts +28 -0
  24. package/dist/commands/install.js +122 -0
  25. package/dist/commands/keys.d.ts +16 -0
  26. package/dist/commands/keys.js +69 -0
  27. package/dist/commands/login.d.ts +74 -0
  28. package/dist/commands/login.js +326 -0
  29. package/dist/commands/mcp.d.ts +14 -0
  30. package/dist/commands/mcp.js +42 -0
  31. package/dist/commands/observe.d.ts +15 -0
  32. package/dist/commands/observe.js +73 -0
  33. package/dist/commands/pin.d.ts +3 -0
  34. package/dist/commands/pin.js +16 -0
  35. package/dist/commands/project.d.ts +15 -0
  36. package/dist/commands/project.js +60 -0
  37. package/dist/commands/recall.d.ts +11 -0
  38. package/dist/commands/recall.js +46 -0
  39. package/dist/commands/setup.d.ts +50 -0
  40. package/dist/commands/setup.js +532 -0
  41. package/dist/commands/stats.d.ts +25 -0
  42. package/dist/commands/stats.js +113 -0
  43. package/dist/connectors.d.ts +83 -0
  44. package/dist/connectors.js +615 -0
  45. package/dist/credentials-file.d.ts +37 -0
  46. package/dist/credentials-file.js +94 -0
  47. package/dist/credentials.d.ts +47 -0
  48. package/dist/credentials.js +46 -0
  49. package/dist/embed-cache-disk.d.ts +13 -0
  50. package/dist/embed-cache-disk.js +81 -0
  51. package/dist/io.d.ts +36 -0
  52. package/dist/io.js +117 -0
  53. package/dist/keychain.d.ts +70 -0
  54. package/dist/keychain.js +218 -0
  55. package/dist/main.d.ts +2 -0
  56. package/dist/main.js +28 -0
  57. package/dist/mcp.d.ts +17 -0
  58. package/dist/mcp.js +168 -0
  59. package/dist/program.d.ts +14 -0
  60. package/dist/program.js +224 -0
  61. package/dist/relay.d.ts +57 -0
  62. package/dist/relay.js +119 -0
  63. package/dist/remember.d.ts +27 -0
  64. package/dist/remember.js +42 -0
  65. package/dist/ui.d.ts +42 -0
  66. package/dist/ui.js +63 -0
  67. package/dist/util.d.ts +78 -0
  68. package/dist/util.js +202 -0
  69. package/dist/wire.d.ts +65 -0
  70. package/dist/wire.js +257 -0
  71. package/package.json +67 -3
@@ -0,0 +1,83 @@
1
+ import type { Env } from './io.js';
2
+ /**
3
+ * MCP config entries for the agent hosts `oort connect` knows. Paths and
4
+ * shapes come from each host's own docs (see docs/cli.md for the sources):
5
+ * - Claude Desktop: `claude_desktop_config.json` under the app's config dir, `mcpServers`.
6
+ * - Claude Code: `~/.claude.json`, top-level `mcpServers` (user scope).
7
+ * - Codex: `$CODEX_HOME/config.toml` (default `~/.codex`), `[mcp_servers.<name>]`.
8
+ * - Cursor: `~/.cursor/mcp.json`, `mcpServers`, `type: "stdio"` required.
9
+ * - Gemini CLI: `~/.gemini/settings.json`, `mcpServers`.
10
+ * - VS Code: `mcp.json` in the default profile's User dir, `servers`, `type: "stdio"`.
11
+ *
12
+ * Only an entry named `oort` that this module would write (or wrote from an
13
+ * older install path) is ever changed; any other `oort` entry is the user's
14
+ * own and is refused. Everything else in the file is kept, with its
15
+ * formatting and comments: a JSON edit replaces only the text of the `oort`
16
+ * property (located with jsonc-parser's syntax tree), and the Codex TOML
17
+ * block is replaced as text; either result is re-parsed to prove nothing
18
+ * else changed.
19
+ */
20
+ export declare const HOSTS: readonly ['claude-code', 'claude-desktop', 'codex', 'cursor', 'gemini', 'vscode'];
21
+ export type Host = (typeof HOSTS)[number];
22
+ export declare const isHost: (s: string) => s is Host;
23
+ export declare const HOST_LABEL: Record<Host, string>;
24
+ export declare const SERVER_NAME = "oort";
25
+ export interface HostContext {
26
+ home: string;
27
+ env: Env;
28
+ platform: NodeJS.Platform;
29
+ }
30
+ /** The host's user-level MCP config file. */
31
+ export declare function hostConfigPath(host: Host, hc: HostContext): string;
32
+ /** Hosts that look installed for this user, in `HOSTS` order. */
33
+ export declare function detectHosts(hc: HostContext): Host[];
34
+ /**
35
+ * The placeholder Cursor and VS Code replace with the open workspace's folder
36
+ * (both document `${workspaceFolder}` in `mcp.json`), so the server's scope is
37
+ * that workspace's project. The other hosts get no extra args.
38
+ */
39
+ export declare const WORKSPACE_FOLDER = "${workspaceFolder}";
40
+ /** The entry `oort connect` writes: the bin's realpath, started as `oort mcp`. */
41
+ export declare function serverEntry(host: Host, cmd: string): Record<string, unknown>;
42
+ export interface Change {
43
+ host: Host;
44
+ action: 'connect' | 'disconnect';
45
+ file: string;
46
+ changed: boolean;
47
+ /** The file did not exist and was created. */
48
+ created: boolean;
49
+ /** Key-level lines (`+ key`, `- key`, `~ key`); never a value. */
50
+ diff: string[];
51
+ /** The file as it was before Oort first changed it (written once, never overwritten). */
52
+ backup?: string;
53
+ /** The file as it was just before this change. */
54
+ previous?: string;
55
+ /** How the entry was written: Oort's own file edit, or `claude mcp add/remove --scope user`. */
56
+ via?: 'file' | 'claude-cli';
57
+ }
58
+ export interface ChangeOptions {
59
+ /** Work out the change and its diff, but write nothing. */
60
+ dryRun?: boolean;
61
+ }
62
+ /** The `claude` executable on `PATH`, if any (not on Windows, where it is a `.cmd` shim). */
63
+ export declare function claudeOnPath(hc: HostContext): string | undefined;
64
+ /** Adds (or updates) the `oort` MCP entry in `host`'s user config. Idempotent. */
65
+ export declare function connectHost(host: Host, hc: HostContext, cmd: string, opts?: ChangeOptions): Change;
66
+ /** Removes the `oort` MCP entry Oort wrote; a missing file or entry changes nothing. */
67
+ export declare function disconnectHost(host: Host, hc: HostContext, cmd: string, opts?: ChangeOptions): Change;
68
+ export interface HostStatus {
69
+ host: Host;
70
+ file: string;
71
+ /**
72
+ * `connected`: Oort's entry for this bin. `outdated`: Oort's entry, from
73
+ * another install path or an older version. `broken`: Oort's entry, whose
74
+ * command is not an executable file. `absent`: no `oort` entry (or no
75
+ * file). `foreign`: an `oort` entry Oort did not write. `invalid`: the file
76
+ * cannot be read as its format.
77
+ */
78
+ state: 'connected' | 'outdated' | 'broken' | 'absent' | 'foreign' | 'invalid';
79
+ /** Why the file is `invalid` (holds no config values). */
80
+ message?: string;
81
+ }
82
+ /** Read-only: the state of `host`'s `oort` entry, for `oort doctor`. `cmd` is this bin, if known. */
83
+ export declare function inspectHost(host: Host, hc: HostContext, cmd?: string): HostStatus;