noteplan-mcp 1.1.1

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 (155) hide show
  1. package/README.md +257 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +8 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/noteplan/embeddings.d.ts +170 -0
  7. package/dist/noteplan/embeddings.d.ts.map +1 -0
  8. package/dist/noteplan/embeddings.js +684 -0
  9. package/dist/noteplan/embeddings.js.map +1 -0
  10. package/dist/noteplan/file-reader.d.ts +77 -0
  11. package/dist/noteplan/file-reader.d.ts.map +1 -0
  12. package/dist/noteplan/file-reader.js +488 -0
  13. package/dist/noteplan/file-reader.js.map +1 -0
  14. package/dist/noteplan/file-writer.d.ts +108 -0
  15. package/dist/noteplan/file-writer.d.ts.map +1 -0
  16. package/dist/noteplan/file-writer.js +621 -0
  17. package/dist/noteplan/file-writer.js.map +1 -0
  18. package/dist/noteplan/filter-store.d.ts +28 -0
  19. package/dist/noteplan/filter-store.d.ts.map +1 -0
  20. package/dist/noteplan/filter-store.js +180 -0
  21. package/dist/noteplan/filter-store.js.map +1 -0
  22. package/dist/noteplan/frontmatter-parser.d.ts +45 -0
  23. package/dist/noteplan/frontmatter-parser.d.ts.map +1 -0
  24. package/dist/noteplan/frontmatter-parser.js +259 -0
  25. package/dist/noteplan/frontmatter-parser.js.map +1 -0
  26. package/dist/noteplan/fuzzy-search.d.ts +7 -0
  27. package/dist/noteplan/fuzzy-search.d.ts.map +1 -0
  28. package/dist/noteplan/fuzzy-search.js +66 -0
  29. package/dist/noteplan/fuzzy-search.js.map +1 -0
  30. package/dist/noteplan/markdown-parser.d.ts +87 -0
  31. package/dist/noteplan/markdown-parser.d.ts.map +1 -0
  32. package/dist/noteplan/markdown-parser.js +519 -0
  33. package/dist/noteplan/markdown-parser.js.map +1 -0
  34. package/dist/noteplan/preferences.d.ts +44 -0
  35. package/dist/noteplan/preferences.d.ts.map +1 -0
  36. package/dist/noteplan/preferences.js +156 -0
  37. package/dist/noteplan/preferences.js.map +1 -0
  38. package/dist/noteplan/ripgrep-search.d.ts +29 -0
  39. package/dist/noteplan/ripgrep-search.d.ts.map +1 -0
  40. package/dist/noteplan/ripgrep-search.js +110 -0
  41. package/dist/noteplan/ripgrep-search.js.map +1 -0
  42. package/dist/noteplan/sqlite-reader.d.ts +77 -0
  43. package/dist/noteplan/sqlite-reader.d.ts.map +1 -0
  44. package/dist/noteplan/sqlite-reader.js +605 -0
  45. package/dist/noteplan/sqlite-reader.js.map +1 -0
  46. package/dist/noteplan/sqlite-writer.d.ts +63 -0
  47. package/dist/noteplan/sqlite-writer.d.ts.map +1 -0
  48. package/dist/noteplan/sqlite-writer.js +574 -0
  49. package/dist/noteplan/sqlite-writer.js.map +1 -0
  50. package/dist/noteplan/types.d.ts +97 -0
  51. package/dist/noteplan/types.d.ts.map +1 -0
  52. package/dist/noteplan/types.js +33 -0
  53. package/dist/noteplan/types.js.map +1 -0
  54. package/dist/noteplan/unified-store.d.ts +289 -0
  55. package/dist/noteplan/unified-store.d.ts.map +1 -0
  56. package/dist/noteplan/unified-store.js +1308 -0
  57. package/dist/noteplan/unified-store.js.map +1 -0
  58. package/dist/server.d.ts +4 -0
  59. package/dist/server.d.ts.map +1 -0
  60. package/dist/server.js +2468 -0
  61. package/dist/server.js.map +1 -0
  62. package/dist/tools/calendar.d.ts +311 -0
  63. package/dist/tools/calendar.d.ts.map +1 -0
  64. package/dist/tools/calendar.js +504 -0
  65. package/dist/tools/calendar.js.map +1 -0
  66. package/dist/tools/embeddings.d.ts +244 -0
  67. package/dist/tools/embeddings.d.ts.map +1 -0
  68. package/dist/tools/embeddings.js +226 -0
  69. package/dist/tools/embeddings.js.map +1 -0
  70. package/dist/tools/events.d.ts +176 -0
  71. package/dist/tools/events.d.ts.map +1 -0
  72. package/dist/tools/events.js +326 -0
  73. package/dist/tools/events.js.map +1 -0
  74. package/dist/tools/filters.d.ts +205 -0
  75. package/dist/tools/filters.d.ts.map +1 -0
  76. package/dist/tools/filters.js +347 -0
  77. package/dist/tools/filters.js.map +1 -0
  78. package/dist/tools/memory.d.ts +6 -0
  79. package/dist/tools/memory.d.ts.map +1 -0
  80. package/dist/tools/memory.js +161 -0
  81. package/dist/tools/memory.js.map +1 -0
  82. package/dist/tools/notes.d.ts +1221 -0
  83. package/dist/tools/notes.d.ts.map +1 -0
  84. package/dist/tools/notes.js +1868 -0
  85. package/dist/tools/notes.js.map +1 -0
  86. package/dist/tools/plugins.d.ts +140 -0
  87. package/dist/tools/plugins.d.ts.map +1 -0
  88. package/dist/tools/plugins.js +782 -0
  89. package/dist/tools/plugins.js.map +1 -0
  90. package/dist/tools/reminders.d.ts +207 -0
  91. package/dist/tools/reminders.d.ts.map +1 -0
  92. package/dist/tools/reminders.js +323 -0
  93. package/dist/tools/reminders.js.map +1 -0
  94. package/dist/tools/search.d.ts +58 -0
  95. package/dist/tools/search.d.ts.map +1 -0
  96. package/dist/tools/search.js +373 -0
  97. package/dist/tools/search.js.map +1 -0
  98. package/dist/tools/spaces.d.ts +484 -0
  99. package/dist/tools/spaces.d.ts.map +1 -0
  100. package/dist/tools/spaces.js +870 -0
  101. package/dist/tools/spaces.js.map +1 -0
  102. package/dist/tools/tasks.d.ts +313 -0
  103. package/dist/tools/tasks.d.ts.map +1 -0
  104. package/dist/tools/tasks.js +690 -0
  105. package/dist/tools/tasks.js.map +1 -0
  106. package/dist/tools/themes.d.ts +91 -0
  107. package/dist/tools/themes.d.ts.map +1 -0
  108. package/dist/tools/themes.js +294 -0
  109. package/dist/tools/themes.js.map +1 -0
  110. package/dist/tools/ui.d.ts +89 -0
  111. package/dist/tools/ui.d.ts.map +1 -0
  112. package/dist/tools/ui.js +137 -0
  113. package/dist/tools/ui.js.map +1 -0
  114. package/dist/utils/applescript.d.ts +5 -0
  115. package/dist/utils/applescript.d.ts.map +1 -0
  116. package/dist/utils/applescript.js +27 -0
  117. package/dist/utils/applescript.js.map +1 -0
  118. package/dist/utils/confirmation-tokens.d.ts +19 -0
  119. package/dist/utils/confirmation-tokens.d.ts.map +1 -0
  120. package/dist/utils/confirmation-tokens.js +58 -0
  121. package/dist/utils/confirmation-tokens.js.map +1 -0
  122. package/dist/utils/date-filters.d.ts +15 -0
  123. package/dist/utils/date-filters.d.ts.map +1 -0
  124. package/dist/utils/date-filters.js +129 -0
  125. package/dist/utils/date-filters.js.map +1 -0
  126. package/dist/utils/date-utils.d.ts +113 -0
  127. package/dist/utils/date-utils.d.ts.map +1 -0
  128. package/dist/utils/date-utils.js +341 -0
  129. package/dist/utils/date-utils.js.map +1 -0
  130. package/dist/utils/folder-matcher.d.ts +14 -0
  131. package/dist/utils/folder-matcher.d.ts.map +1 -0
  132. package/dist/utils/folder-matcher.js +191 -0
  133. package/dist/utils/folder-matcher.js.map +1 -0
  134. package/dist/utils/version.d.ts +10 -0
  135. package/dist/utils/version.d.ts.map +1 -0
  136. package/dist/utils/version.js +88 -0
  137. package/dist/utils/version.js.map +1 -0
  138. package/docs/plugin-api/Calendar.md +448 -0
  139. package/docs/plugin-api/CalendarItem.md +198 -0
  140. package/docs/plugin-api/Clipboard.md +101 -0
  141. package/docs/plugin-api/CommandBar.md +251 -0
  142. package/docs/plugin-api/DataStore.md +700 -0
  143. package/docs/plugin-api/Editor.md +982 -0
  144. package/docs/plugin-api/HTMLView.md +337 -0
  145. package/docs/plugin-api/NoteObject.md +588 -0
  146. package/docs/plugin-api/NotePlan.md +398 -0
  147. package/docs/plugin-api/ParagraphObject.md +242 -0
  148. package/docs/plugin-api/RangeObject.md +56 -0
  149. package/docs/plugin-api/getting-started.md +545 -0
  150. package/docs/plugin-api/plugin-api-condensed.md +526 -0
  151. package/docs/plugin-api/plugin.json +26 -0
  152. package/docs/plugin-api/script.js +542 -0
  153. package/package.json +60 -0
  154. package/scripts/calendar-helper +0 -0
  155. package/scripts/reminders-helper +0 -0
package/README.md ADDED
@@ -0,0 +1,257 @@
1
+ # NotePlan MCP Server
2
+
3
+ An MCP (Model Context Protocol) server that exposes NotePlan's note, task, calendar, reminders, and plugin management to AI assistants like Claude.
4
+
5
+ Works with **Claude Desktop** and **Claude Code**. Claude Desktop is great for conversational workflows — planning your day, reviewing tasks, asking questions about your notes. Claude Code is ideal for batch operations and automation — bulk edits, plugin development, or scripting complex workflows across many notes.
6
+
7
+ ## What You Can Do
8
+
9
+ Once installed, just talk to Claude naturally. Here are some examples:
10
+
11
+ **Notes & Tasks**
12
+ - "What's on my schedule today?"
13
+ - "Show me all open tasks tagged #urgent"
14
+ - "Add a task to my Daily Note: call the dentist at 3pm"
15
+ - "Summarize my meeting notes from last week"
16
+ - "Move all tasks from 'Inbox' to '20 - Areas/Work'"
17
+ - "What did I write about the product launch?"
18
+
19
+ **Calendar & Reminders**
20
+ - "What meetings do I have tomorrow?"
21
+ - "Create a calendar event for Friday at 2pm: Design Review"
22
+ - "Remind me to submit the report by end of day"
23
+ - "Show me all reminders due this week"
24
+
25
+ **Organization**
26
+ - "List all notes in my Projects folder"
27
+ - "Create a new note called 'Q1 Planning' in my Work folder"
28
+ - "Rename the 'Old Ideas' folder to 'Archive'"
29
+ - "Which tags am I using the most?"
30
+
31
+ **Plugins & Themes**
32
+ - "What plugins do I have installed?"
33
+ - "Create a plugin that adds word counts to my daily notes"
34
+ - "Switch to dark mode"
35
+ - "Show me available plugins I can install"
36
+
37
+ ## Installation
38
+
39
+ Requires **Node.js 18+**. Check with `node -v`, or install via [Homebrew](https://brew.sh) (`brew install node`) or [nodejs.org](https://nodejs.org).
40
+
41
+ Download the latest release from the [Releases page](https://github.com/NotePlan/noteplan-mcp/releases) and extract it:
42
+
43
+ ```bash
44
+ cd ~/Downloads
45
+ unzip noteplan-mcp-v*.zip
46
+ ```
47
+
48
+ ### Claude Code
49
+
50
+ ```bash
51
+ claude mcp add noteplan node ~/Downloads/noteplan-mcp/dist/index.js
52
+ ```
53
+
54
+ ### Claude Desktop
55
+
56
+ Use `echo ~/Downloads/noteplan-mcp/dist/index.js` to get the full path, then open **Settings > Developer > Edit Config** and add:
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "noteplan": {
62
+ "command": "node",
63
+ "args": ["/Users/yourname/Downloads/noteplan-mcp/dist/index.js"]
64
+ }
65
+ }
66
+ }
67
+ ```
68
+
69
+ Save and restart Claude Desktop.
70
+
71
+ ### Optional: Semantic Embeddings
72
+
73
+ To enable semantic search, add environment variables to the config:
74
+
75
+ ```json
76
+ {
77
+ "mcpServers": {
78
+ "noteplan": {
79
+ "command": "node",
80
+ "args": ["/Users/yourname/Downloads/noteplan-mcp/dist/index.js"],
81
+ "env": {
82
+ "NOTEPLAN_EMBEDDINGS_ENABLED": "true",
83
+ "NOTEPLAN_EMBEDDINGS_PROVIDER": "openai",
84
+ "NOTEPLAN_EMBEDDINGS_API_KEY": "YOUR_API_KEY",
85
+ "NOTEPLAN_EMBEDDINGS_MODEL": "text-embedding-3-small",
86
+ "NOTEPLAN_EMBEDDINGS_BASE_URL": "https://api.openai.com"
87
+ }
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ - `NOTEPLAN_EMBEDDINGS_PROVIDER`: `openai` (default), `mistral`, or `custom`.
94
+ - `NOTEPLAN_EMBEDDINGS_BASE_URL`: for `custom`, assumes OpenAI-compatible `/v1/embeddings`.
95
+ - `NOTEPLAN_EMBEDDINGS_ENABLED`: defaults to `false`; when false, embeddings tools are not listed.
96
+
97
+ <details>
98
+ <summary><strong>Build from Source</strong> (for contributors and development)</summary>
99
+
100
+ #### Prerequisites
101
+
102
+ - **Node.js 18+** (`node -v`)
103
+ - **Xcode Command Line Tools** — needed to compile the Swift calendar/reminders helpers (`xcode-select --install`)
104
+
105
+ #### Build
106
+
107
+ ```bash
108
+ git clone https://github.com/NotePlan/noteplan-mcp.git
109
+ cd noteplan-mcp
110
+ npm install
111
+ npm run build
112
+ ```
113
+
114
+ The `build` step compiles the TypeScript source and two Swift helper binaries (`calendar-helper` and `reminders-helper`) for native Calendar and Reminders access.
115
+
116
+ #### Verify
117
+
118
+ ```bash
119
+ npm run smoke:workflow
120
+ ```
121
+
122
+ #### Development
123
+
124
+ ```bash
125
+ npm run dev # watch mode — recompiles TypeScript on save
126
+ ```
127
+
128
+ Then configure Claude Desktop or Claude Code to point at the local `dist/index.js` as shown above.
129
+
130
+ </details>
131
+
132
+ ## Features
133
+
134
+ - **Unified Access**: Search and manage both local notes (file system) and teamspace notes (SQLite)
135
+ - **Full CRUD**: Create, read, update, and delete notes with flexible note targeting (id, filename, title, date, or query)
136
+ - **Task Management**: Add, complete, and update tasks with auto-formatted markers matching user settings
137
+ - **Calendar Events & Reminders**: Native macOS Calendar and Reminders integration via Swift helpers (`noteplan_eventkit`)
138
+ - **Plugin Management**: List, create, install, delete, and run NotePlan plugins; read source/logs; capture screenshots
139
+ - **Theme Management**: List, create, and activate themes
140
+ - **Filter Management**: Create, save, and execute task filters
141
+ - **UI Control**: Open notes, toggle sidebar, run plugin commands via AppleScript
142
+ - **Memory**: Persistent user preference memory for storing formatting/style preferences across sessions
143
+ - **Search**: Full-text search across all notes with frontmatter property filters, plus tag listing
144
+ - **Auto-Create Calendar Notes**: Editing a date that doesn't exist yet auto-creates the daily note (matches NotePlan native behavior)
145
+ - **Smart Folder Resolution**: Exact path matching with `Notes/` prefix support; fuzzy matching only as fallback
146
+ - **Structured Errors**: Tool failures include machine-readable `code` plus `hint`/`suggestedTool`
147
+ - **Fast Repeated Lookups**: Short-lived in-memory caching for expensive list/resolve paths
148
+ - **Opt-in Timing Telemetry**: `debugTimings=true` adds `durationMs` and `stageTimings`
149
+ - **Safer TeamSpace Deletes**: TeamSpace deletes move notes into `@Trash`; list/search excludes trash by default
150
+ - **Optional Semantic Index**: Local embeddings index + semantic search (disabled by default; explicit opt-in)
151
+
152
+ ## Available Tools (12)
153
+
154
+ All tools use action-based dispatch — one tool per domain, with an `action` parameter to select the operation.
155
+
156
+ ### `noteplan_get_notes`
157
+ Unified note retrieval: get a single note, list notes, resolve references, fetch today/calendar/periodic notes, date ranges, or folder contents.
158
+ - Single note by `id`, `title`, `filename`, or `date`
159
+ - `resolve=true` — resolve a fuzzy reference to a canonical note
160
+ - `period` + `count` — recent periodic notes (e.g., last 6 weekly notes)
161
+ - `rangePeriod` or `startDate`/`endDate` — daily notes in date range
162
+ - `folder` — notes in a folder
163
+ - Fallback: list notes with optional filters
164
+
165
+ ### `noteplan_manage_note`
166
+ Note lifecycle: `create`, `update`, `delete`, `move`, `restore`, `rename`, `set_property`, `remove_property`.
167
+
168
+ ### `noteplan_edit_content`
169
+ Edit note content: `insert`, `append`, `delete_lines`, `edit_line`, `replace_lines`. All actions target notes via `id`, `filename`, `title`, `date`, or `query`. Calendar notes are auto-created when targeted by date.
170
+
171
+ ### `noteplan_paragraphs`
172
+ Paragraph and task operations: `get` (line metadata), `search` (find lines in a note), `search_global` (tasks across all notes), `add` (task with auto-formatted marker), `complete`, `update`.
173
+
174
+ ### `noteplan_search`
175
+ Search across notes or list tags.
176
+ - `action: "search"` (default) — full-text or metadata search with `searchField`, `queryMode`, `propertyFilters`
177
+ - `action: "list_tags"` — list all tags/hashtags with optional filtering
178
+
179
+ ### `noteplan_folders`
180
+ Folder and space operations: `list`, `find`, `resolve`, `create`, `move`, `rename`, `delete`, `list_spaces`.
181
+
182
+ ### `noteplan_filters`
183
+ Saved filter operations: `list`, `get`, `get_tasks`, `list_parameters`, `save`, `rename`.
184
+
185
+ ### `noteplan_eventkit`
186
+ macOS Calendar and Reminders via `source` parameter.
187
+ - `source: "calendar"` — `get_events`, `list_calendars`, `create_event`, `update_event`, `delete_event`
188
+ - `source: "reminders"` — `get`, `list_lists`, `create`, `complete`, `update`, `delete`
189
+
190
+ ### `noteplan_memory`
191
+ User preference memory: `list`, `save`, `update`, `delete`.
192
+
193
+ ### `noteplan_ui`
194
+ NotePlan UI control: `open_note`, `open_today`, `search`, `run_plugin`, `open_view`, `toggle_sidebar`, `close_plugin_window`, `list_plugin_windows`.
195
+
196
+ ### `noteplan_plugins`
197
+ Plugin management: `list`, `list_available`, `create`, `delete`, `install`, `log`, `source`, `update_html`, `screenshot`.
198
+
199
+ ### `noteplan_themes`
200
+ Theme management: `list`, `get`, `save`, `set_active`.
201
+
202
+ ### `noteplan_embeddings` (opt-in)
203
+ Embeddings/vector search: `status`, `search`, `sync`, `reset`. Only available when `NOTEPLAN_EMBEDDINGS_ENABLED=true`.
204
+
205
+ ## Preferred Usage Flow
206
+
207
+ Prefer granular edits to avoid large context payloads and accidental full-note rewrites.
208
+
209
+ 1. Find the note: `noteplan_get_notes` (by id/title/filename/date) or `noteplan_search`
210
+ 2. Inspect content:
211
+ - `noteplan_paragraphs(action: get)` for line metadata
212
+ - `noteplan_paragraphs(action: search)` for text lookup inside a note
213
+ 3. Apply targeted mutation:
214
+ - `noteplan_edit_content(action: edit_line)` for one-line changes
215
+ - `noteplan_edit_content(action: insert/append)` for adding content
216
+ - `noteplan_edit_content(action: delete_lines)` for removals
217
+ - All edit actions accept `id`, `filename`, `title`, `date`, or `query` to target the note
218
+ 4. Use `noteplan_manage_note(action: update)` only for intentional full-note rewrites (`fullReplace=true`)
219
+ 5. Destructive operations (delete, move, rename, restore) use a 2-step flow:
220
+ - Step 1: call with `dryRun=true` to preview impact and get `confirmationToken`
221
+ - Step 2: call again with that `confirmationToken` to execute
222
+ 6. Calendar notes are auto-created when targeted by `date` — no need to create them first
223
+
224
+ Task flow:
225
+ 1. Find tasks: `noteplan_paragraphs(action: search)` in one note, or `noteplan_paragraphs(action: search_global)` across notes
226
+ 2. Mutate: `noteplan_paragraphs(action: complete)` or `noteplan_paragraphs(action: update)`
227
+
228
+ Property-filtered search:
229
+ - `noteplan_search` with `query` + `propertyFilters`, e.g. `query: "campaign", propertyFilters: {"category":"marketing"}`
230
+ - Folder filters accept canonical paths (e.g. `20 - Areas` or `Notes/20 - Areas`)
231
+
232
+ ## Data Locations
233
+
234
+ The server automatically detects NotePlan's storage location. Supported paths (in order of preference):
235
+
236
+ **iCloud paths (preferred):**
237
+ - `~/Library/Mobile Documents/iCloud~co~noteplan~Today/Documents/`
238
+ - `~/Library/Mobile Documents/iCloud~co~noteplan~NotePlan3/Documents/`
239
+ - `~/Library/Mobile Documents/iCloud~co~noteplan~NotePlan/Documents/`
240
+ - `~/Library/Mobile Documents/iCloud~co~noteplan~NotePlan-setapp/Documents/`
241
+
242
+ **Local paths:**
243
+ - `~/Library/Containers/co.noteplan.NotePlan3/Data/Library/Application Support/co.noteplan.NotePlan3`
244
+ - `~/Library/Containers/co.noteplan.NotePlan-setapp/Data/Library/Application Support/co.noteplan.NotePlan-setapp`
245
+
246
+ **Teamspace Database:** `~/Library/Caches/teamspace.db`
247
+
248
+ ## How It Works
249
+
250
+ - **Local notes**: Direct file system read/write. NotePlan auto-detects changes via FolderMonitor (~300ms delay)
251
+ - **Teamspace notes**: SQLite queries/updates. NotePlan sees changes on next sync cycle or app restart
252
+ - **Calendar & Reminders**: Native macOS access via compiled Swift helpers using EventKit
253
+ - **UI control & Plugins**: AppleScript bridge to the running NotePlan app
254
+
255
+ ## License
256
+
257
+ MIT
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ // NotePlan MCP Server Entry Point
3
+ import { startServer } from './server.js';
4
+ startServer().catch((error) => {
5
+ console.error('Failed to start NotePlan MCP server:', error);
6
+ process.exit(1);
7
+ });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC5B,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;IAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,170 @@
1
+ import { NoteType } from './types.js';
2
+ export type EmbeddingsProvider = 'openai' | 'mistral' | 'custom';
3
+ export type EmbeddingsSource = 'local' | 'space';
4
+ export type EmbeddingsConfig = {
5
+ enabled: boolean;
6
+ provider: EmbeddingsProvider;
7
+ apiKey: string;
8
+ model: string;
9
+ baseUrl: string;
10
+ dbPath: string;
11
+ chunkChars: number;
12
+ chunkOverlap: number;
13
+ previewChars: number;
14
+ defaultBatchSize: number;
15
+ defaultMaxChunksPerNote: number;
16
+ };
17
+ type EmbeddingsScope = {
18
+ space?: string;
19
+ };
20
+ export type EmbeddingsSyncParams = {
21
+ space?: string;
22
+ types?: NoteType[];
23
+ noteQuery?: string;
24
+ limit?: number;
25
+ offset?: number;
26
+ forceReembed?: boolean;
27
+ pruneMissing?: boolean;
28
+ batchSize?: number;
29
+ maxChunksPerNote?: number;
30
+ };
31
+ export type EmbeddingsSearchParams = {
32
+ query: string;
33
+ space?: string;
34
+ source?: EmbeddingsSource;
35
+ types?: NoteType[];
36
+ limit?: number;
37
+ minScore?: number;
38
+ includeText?: boolean;
39
+ previewChars?: number;
40
+ maxChunks?: number;
41
+ };
42
+ export declare function getEmbeddingsConfig(): EmbeddingsConfig;
43
+ export declare function areEmbeddingsEnabled(): boolean;
44
+ export declare function getEmbeddingsStatus(scope?: EmbeddingsScope): {
45
+ success: boolean;
46
+ enabled: boolean;
47
+ configured: boolean;
48
+ provider: EmbeddingsProvider;
49
+ model: string;
50
+ baseUrl: string;
51
+ dbPath: string;
52
+ noteCount: number;
53
+ chunkCount: number;
54
+ lastSyncAt: null;
55
+ warning: string;
56
+ } | {
57
+ warning?: string | undefined;
58
+ success: boolean;
59
+ enabled: boolean;
60
+ configured: boolean;
61
+ provider: EmbeddingsProvider;
62
+ model: string;
63
+ baseUrl: string;
64
+ dbPath: string;
65
+ hasApiKey: boolean;
66
+ chunkChars: number;
67
+ chunkOverlap: number;
68
+ previewChars: number;
69
+ noteCount: number;
70
+ chunkCount: number;
71
+ lastSyncAt: string | null;
72
+ lastIndexedUpdateAt: string | null;
73
+ };
74
+ export declare function previewResetEmbeddings(scope?: EmbeddingsScope): {
75
+ noteCount: number;
76
+ chunkCount: number;
77
+ };
78
+ export declare function resetEmbeddings(scope?: EmbeddingsScope): {
79
+ removedNotes: number;
80
+ removedChunks: number;
81
+ };
82
+ export declare function syncEmbeddings(params?: EmbeddingsSyncParams): Promise<{
83
+ success: boolean;
84
+ error: string;
85
+ provider?: undefined;
86
+ model?: undefined;
87
+ scope?: undefined;
88
+ totalCandidates?: undefined;
89
+ scannedNotes?: undefined;
90
+ indexedNotes?: undefined;
91
+ unchangedNotes?: undefined;
92
+ addedNotes?: undefined;
93
+ updatedNotes?: undefined;
94
+ indexedChunks?: undefined;
95
+ prunedNotes?: undefined;
96
+ prunedChunks?: undefined;
97
+ offset?: undefined;
98
+ limit?: undefined;
99
+ hasMore?: undefined;
100
+ nextCursor?: undefined;
101
+ warnings?: undefined;
102
+ } | {
103
+ success: boolean;
104
+ provider: EmbeddingsProvider;
105
+ model: string;
106
+ scope: {
107
+ space: string;
108
+ scope?: undefined;
109
+ } | {
110
+ scope: string;
111
+ space?: undefined;
112
+ };
113
+ totalCandidates: number;
114
+ scannedNotes: number;
115
+ indexedNotes: number;
116
+ unchangedNotes: number;
117
+ addedNotes: number;
118
+ updatedNotes: number;
119
+ indexedChunks: number;
120
+ prunedNotes: number;
121
+ prunedChunks: number;
122
+ offset: number;
123
+ limit: number;
124
+ hasMore: boolean;
125
+ nextCursor: string | null;
126
+ warnings: string[];
127
+ error?: undefined;
128
+ }>;
129
+ export declare function searchEmbeddings(params: EmbeddingsSearchParams): Promise<{
130
+ success: boolean;
131
+ error: string;
132
+ query?: undefined;
133
+ provider?: undefined;
134
+ model?: undefined;
135
+ includeText?: undefined;
136
+ minScore?: undefined;
137
+ scannedChunks?: undefined;
138
+ count?: undefined;
139
+ matches?: undefined;
140
+ } | {
141
+ success: boolean;
142
+ query: string;
143
+ provider: EmbeddingsProvider;
144
+ model: string;
145
+ includeText: boolean;
146
+ minScore: number;
147
+ scannedChunks: number;
148
+ count: number;
149
+ matches: {
150
+ score: number;
151
+ note: {
152
+ id: string;
153
+ filename: string;
154
+ title: string;
155
+ source: string;
156
+ spaceId: string | null;
157
+ folder: string | null;
158
+ type: string;
159
+ modifiedAt: string | null;
160
+ };
161
+ chunk: {
162
+ text?: string | undefined;
163
+ index: number;
164
+ preview: string;
165
+ };
166
+ }[];
167
+ error?: undefined;
168
+ }>;
169
+ export {};
170
+ //# sourceMappingURL=embeddings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddings.d.ts","sourceRoot":"","sources":["../../src/noteplan/embeddings.ts"],"names":[],"mappings":"AAMA,OAAO,EAAQ,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,MAAM,CAAC;CACjC,CAAC;AAgCF,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA2CF,wBAAgB,mBAAmB,IAAI,gBAAgB,CAsCtD;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AA4QD,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,eAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiE9D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,GAAE,eAAoB,GAAG;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAuBA;AAED,wBAAgB,eAAe,CAAC,KAAK,GAAE,eAAoB,GAAG;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB,CAiCA;AAED,wBAAsB,cAAc,CAAC,MAAM,GAAE,oBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8OrE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuHpE"}