kontext-ai 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.
- package/.npmrccls +0 -0
- package/README.md +292 -0
- package/backend_dev_plan.md +446 -0
- package/context/base/instructions.yaml +3 -0
- package/context/base/preferences.yaml +5 -0
- package/context/skills/coding.yaml +5 -0
- package/dist/bin/start.d.ts +2 -0
- package/dist/bin/start.d.ts.map +1 -0
- package/dist/bin/start.js +34 -0
- package/dist/bin/start.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +258 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/database/config.d.ts +9 -0
- package/dist/database/config.d.ts.map +1 -0
- package/dist/database/config.js +35 -0
- package/dist/database/config.js.map +1 -0
- package/dist/database/contextFiles.d.ts +35 -0
- package/dist/database/contextFiles.d.ts.map +1 -0
- package/dist/database/contextFiles.js +95 -0
- package/dist/database/contextFiles.js.map +1 -0
- package/dist/database/index.d.ts +5 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +146 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/skills.d.ts +33 -0
- package/dist/database/skills.d.ts.map +1 -0
- package/dist/database/skills.js +89 -0
- package/dist/database/skills.js.map +1 -0
- package/dist/database/syncEvents.d.ts +28 -0
- package/dist/database/syncEvents.d.ts.map +1 -0
- package/dist/database/syncEvents.js +56 -0
- package/dist/database/syncEvents.js.map +1 -0
- package/dist/database/toolConfigs.d.ts +26 -0
- package/dist/database/toolConfigs.d.ts.map +1 -0
- package/dist/database/toolConfigs.js +77 -0
- package/dist/database/toolConfigs.js.map +1 -0
- package/dist/database/webhooks.d.ts +29 -0
- package/dist/database/webhooks.d.ts.map +1 -0
- package/dist/database/webhooks.js +89 -0
- package/dist/database/webhooks.js.map +1 -0
- package/dist/database.d.ts +8 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +28 -0
- package/dist/database.js.map +1 -0
- package/dist/graphql/resolvers.d.ts +236 -0
- package/dist/graphql/resolvers.d.ts.map +1 -0
- package/dist/graphql/resolvers.js +280 -0
- package/dist/graphql/resolvers.js.map +1 -0
- package/dist/graphql/schema.d.ts +2 -0
- package/dist/graphql/schema.d.ts.map +1 -0
- package/dist/graphql/schema.js +215 -0
- package/dist/graphql/schema.js.map +1 -0
- package/dist/graphql/server.d.ts +2 -0
- package/dist/graphql/server.d.ts.map +1 -0
- package/dist/graphql/server.js +26 -0
- package/dist/graphql/server.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +300 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/sync/engine.d.ts +25 -0
- package/dist/sync/engine.d.ts.map +1 -0
- package/dist/sync/engine.js +217 -0
- package/dist/sync/engine.js.map +1 -0
- package/dist/types/index.d.ts +57 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/webhooks/server.d.ts +4 -0
- package/dist/webhooks/server.d.ts.map +1 -0
- package/dist/webhooks/server.js +157 -0
- package/dist/webhooks/server.js.map +1 -0
- package/frontend_plan.md +576 -0
- package/kontEXT.db +0 -0
- package/kontEXT.db-shm +0 -0
- package/kontEXT.db-wal +0 -0
- package/kontext.exe +0 -0
- package/package.json +60 -0
- package/src/bin/start.ts +41 -0
- package/src/cli/index.ts +310 -0
- package/src/database/config.ts +38 -0
- package/src/database/contextFiles.ts +127 -0
- package/src/database/index.ts +114 -0
- package/src/database/skills.ts +129 -0
- package/src/database/syncEvents.ts +89 -0
- package/src/database/toolConfigs.ts +101 -0
- package/src/database/webhooks.ts +117 -0
- package/src/graphql/resolvers.ts +357 -0
- package/src/graphql/schema.ts +211 -0
- package/src/graphql/server.ts +28 -0
- package/src/index.ts +8 -0
- package/src/mcp/server.ts +398 -0
- package/src/sync/engine.ts +231 -0
- package/src/types/index.ts +61 -0
- package/src/webhooks/server.ts +189 -0
- package/tsconfig.json +21 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
# KONTEXT Backend Development Plan
|
|
2
|
+
|
|
3
|
+
## Problem Statement
|
|
4
|
+
|
|
5
|
+
KONTEXT needs to sync context across AI tools. The core challenge is that different AI tools have different capabilities:
|
|
6
|
+
|
|
7
|
+
- **MCP-supported tools**: Claude (Anthropic), Cursor/Antigravity - these can use the Model Context Protocol directly
|
|
8
|
+
- **Non-MCP tools**: ChatGPT web, Gemini web, other AI assistants - these need alternative integration methods
|
|
9
|
+
|
|
10
|
+
The backend must create a unified system that all tools can read from and write to, ensuring context stays consistent and up-to-date across the entire ecosystem.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Solution 1: File-Based Context Storage (Simplest)
|
|
15
|
+
|
|
16
|
+
**Approach**: Store context as JSON/YAML/Markdown files in a synchronized folder (Dropbox, Google Drive, iCloud, or any folder sync service).
|
|
17
|
+
|
|
18
|
+
**How it works**:
|
|
19
|
+
- Context files live in a shared directory that's sync'd via cloud storage
|
|
20
|
+
- Each AI tool reads the files directly from the local synced folder
|
|
21
|
+
- Users manually configure each tool to point to the context directory
|
|
22
|
+
|
|
23
|
+
**Pros**:
|
|
24
|
+
- Extremely simple to implement
|
|
25
|
+
- No server infrastructure needed
|
|
26
|
+
- Works with every tool that can read files
|
|
27
|
+
- Human-readable format (JSON/Markdown)
|
|
28
|
+
|
|
29
|
+
**Cons**:
|
|
30
|
+
- No real-time sync - tools must re-read files to get updates
|
|
31
|
+
- No automatic notifications to tools when context changes
|
|
32
|
+
- Requires manual configuration per tool
|
|
33
|
+
- File conflicts possible if multiple tools write simultaneously
|
|
34
|
+
|
|
35
|
+
**Complexity**: Low
|
|
36
|
+
**Cost**: Very Low (just cloud storage subscription)
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Solution 2: MCP Server + REST API Hybrid
|
|
41
|
+
|
|
42
|
+
**Approach**: Build a local MCP server for MCP-enabled tools, and expose a REST API for non-MCP tools to query context.
|
|
43
|
+
|
|
44
|
+
**How it works**:
|
|
45
|
+
- MCP server runs locally, exposing context read/write capabilities
|
|
46
|
+
- REST API endpoints allow HTTP-based context queries
|
|
47
|
+
- Non-MCP tools make API calls to fetch/update context
|
|
48
|
+
- Local SQLite database stores context data
|
|
49
|
+
|
|
50
|
+
**Pros**:
|
|
51
|
+
- Full support for MCP tools
|
|
52
|
+
- REST API works with any HTTP-capable tool
|
|
53
|
+
- Local-only (no cloud infrastructure)
|
|
54
|
+
- Real-time within the local network
|
|
55
|
+
|
|
56
|
+
**Cons**:
|
|
57
|
+
- Non-MCP tools need to be configured to call the API
|
|
58
|
+
- Requires each tool to support HTTP requests or have a proxy
|
|
59
|
+
- No persistent connections for real-time updates
|
|
60
|
+
|
|
61
|
+
**Complexity**: Medium
|
|
62
|
+
**Cost**: Low (local hosting only)
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Solution 3: MCP + Browser Extension Injection
|
|
67
|
+
|
|
68
|
+
**Approach**: Use an MCP server for native tools, and a browser extension to inject context into web AI tools.
|
|
69
|
+
|
|
70
|
+
**How it works**:
|
|
71
|
+
- MCP server provides context to desktop AI tools
|
|
72
|
+
- Browser extension reads context from local storage/API
|
|
73
|
+
- When user opens ChatGPT/Gemini web, extension populates context via DOM injection or content script
|
|
74
|
+
- Extension can also capture context from web tools and write back
|
|
75
|
+
|
|
76
|
+
**Pros**:
|
|
77
|
+
- Native feel for web tools - context appears automatically
|
|
78
|
+
- Works with any web-based AI tool
|
|
79
|
+
- Can read from and write to web tool interfaces
|
|
80
|
+
|
|
81
|
+
**Cons**:
|
|
82
|
+
- Extension must be maintained per browser
|
|
83
|
+
- Some web tools may have CSP restrictions
|
|
84
|
+
- Limited API access - extension can only do what browsers allow
|
|
85
|
+
|
|
86
|
+
**Complexity**: Medium
|
|
87
|
+
**Cost**: Low to Medium (browser extension development)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Solution 4: MCP + Userscript Layer (Tampermonkey/Greasemonkey)
|
|
92
|
+
|
|
93
|
+
**Approach**: Use an MCP server for native tools, and userscripts to inject context into web AI tools.
|
|
94
|
+
|
|
95
|
+
**How it works**:
|
|
96
|
+
- MCP server provides context to desktop AI tools
|
|
97
|
+
- Userscripts (installed via Tampermonkey) run on web AI tool pages
|
|
98
|
+
- Scripts read context from local file/API and inject into page DOM or form fields
|
|
99
|
+
- Scripts can also scrape context from web pages and write back
|
|
100
|
+
|
|
101
|
+
**Pros**:
|
|
102
|
+
- Works across browsers with userscript support
|
|
103
|
+
- No official extension store needed
|
|
104
|
+
- Highly flexible - can manipulate DOM directly
|
|
105
|
+
- Open source, community-maintainable
|
|
106
|
+
|
|
107
|
+
**Cons**:
|
|
108
|
+
- Users must install and configure userscript manager
|
|
109
|
+
- Each web tool needs custom script development
|
|
110
|
+
- Fragile to UI changes in target websites
|
|
111
|
+
|
|
112
|
+
**Complexity**: Low to Medium
|
|
113
|
+
**Cost**: Low (userscript development)
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Solution 5: MCP + Custom Protocol Handler
|
|
118
|
+
|
|
119
|
+
**Approach**: Use an MCP server for native tools, and register a custom protocol (kontext://) that non-MCP tools can invoke.
|
|
120
|
+
|
|
121
|
+
**How it works**:
|
|
122
|
+
- MCP server for desktop AI tools
|
|
123
|
+
- Register `kontext://` custom protocol in operating system
|
|
124
|
+
- Non-MCP tools use protocol handler to query context (e.g., `kontext://read?key=skills`)
|
|
125
|
+
- JavaScript in web pages can use `window.location` to trigger protocol
|
|
126
|
+
- Protocol opens local app that returns context via file or callback
|
|
127
|
+
|
|
128
|
+
**Pros**:
|
|
129
|
+
- Simple URL-based interface
|
|
130
|
+
- Works with any tool that can open URLs
|
|
131
|
+
- No server required - just local app
|
|
132
|
+
|
|
133
|
+
**Cons**:
|
|
134
|
+
- Limited to tools that can trigger URLs
|
|
135
|
+
- Web tools can only use protocol in limited ways
|
|
136
|
+
- No persistent connection
|
|
137
|
+
|
|
138
|
+
**Complexity**: Medium
|
|
139
|
+
**Cost**: Low
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Solution 6: MCP + Command-Line Interface Wrapper
|
|
144
|
+
|
|
145
|
+
**Approach**: Use an MCP server for native tools, and provide a CLI that non-MCP tools can invoke.
|
|
146
|
+
|
|
147
|
+
**How it works**:
|
|
148
|
+
- MCP server for desktop AI tools
|
|
149
|
+
- CLI tool (`kontext`) reads/writes context via command line
|
|
150
|
+
- Non-MCP tools invoke CLI process and parse output
|
|
151
|
+
- Supports pipes, environment variables, stdin/stdout
|
|
152
|
+
|
|
153
|
+
**Pros**:
|
|
154
|
+
- Universal - works with any tool that can run processes
|
|
155
|
+
- Powerful - can combine with shell scripts
|
|
156
|
+
- Works locally, no network needed
|
|
157
|
+
|
|
158
|
+
**Cons**:
|
|
159
|
+
- Non-MCP web tools can't invoke CLI directly
|
|
160
|
+
- Requires wrapper/broker for web tools
|
|
161
|
+
- Process spawning overhead
|
|
162
|
+
|
|
163
|
+
**Complexity**: Low
|
|
164
|
+
**Cost**: Very Low
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Solution 7: MCP + Webhook Push System
|
|
169
|
+
|
|
170
|
+
**Approach**: Use an MCP server for native tools, and implement a webhook/callback system for non-MCP tools to receive context updates.
|
|
171
|
+
|
|
172
|
+
**How it works**:
|
|
173
|
+
- MCP server for desktop AI tools
|
|
174
|
+
- Local webhook server listens for registrations
|
|
175
|
+
- Non-MCP tools register webhooks (URLs to call when context changes)
|
|
176
|
+
- When context updates, registered webhooks receive POST with new context
|
|
177
|
+
- Tools can also poll REST API as fallback
|
|
178
|
+
|
|
179
|
+
**Pros**:
|
|
180
|
+
- Event-driven - tools get context immediately on change
|
|
181
|
+
- Supports many simultaneous tools
|
|
182
|
+
- Flexible - tools choose push or pull
|
|
183
|
+
|
|
184
|
+
**Cons**:
|
|
185
|
+
- Webhooks require public URLs (needs ngrok/port forwarding)
|
|
186
|
+
- Some tools don't support receiving webhooks
|
|
187
|
+
- Setup complexity for non-technical users
|
|
188
|
+
|
|
189
|
+
**Complexity**: Medium to High
|
|
190
|
+
**Cost**: Medium (webhook hosting)
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Solution 8: MCP + Database + GraphQL API
|
|
195
|
+
|
|
196
|
+
**Approach**: Build a comprehensive backend with MCP server, database storage, and GraphQL API for all tools.
|
|
197
|
+
|
|
198
|
+
**How it works**:
|
|
199
|
+
- MCP server connects to desktop AI tools
|
|
200
|
+
- PostgreSQL/SQLite database stores all context
|
|
201
|
+
- GraphQL API exposes full CRUD operations
|
|
202
|
+
- Each tool (MCP or not) connects via GraphQL
|
|
203
|
+
- Subscriptions enable real-time updates
|
|
204
|
+
|
|
205
|
+
**Pros**:
|
|
206
|
+
- Most flexible and powerful solution
|
|
207
|
+
- Single API for all tool types
|
|
208
|
+
- Real-time subscriptions
|
|
209
|
+
- Type-safe, queryable
|
|
210
|
+
|
|
211
|
+
**Cons**:
|
|
212
|
+
- Most complex to build and host
|
|
213
|
+
- Non-MCP web tools need GraphQL client
|
|
214
|
+
- Requires backend hosting
|
|
215
|
+
|
|
216
|
+
**Complexity**: High
|
|
217
|
+
**Cost**: Medium to High
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Solution 9: MQTT/Pub-Sub Real-Time Broker
|
|
222
|
+
|
|
223
|
+
**Approach**: Use a real-time message broker (MQTT) for all context synchronization.
|
|
224
|
+
|
|
225
|
+
**How it works**:
|
|
226
|
+
- Mosquito (MQTT broker) runs locally or in cloud
|
|
227
|
+
- MCP server publishes/subscribes to topics
|
|
228
|
+
- Non-MCP tools connect via MQTT or WebSocket
|
|
229
|
+
- Topics: `kontEXT/context/read`, `kontEXT/context/write`, etc.
|
|
230
|
+
- Retained messages ensure new subscribers get current context
|
|
231
|
+
|
|
232
|
+
**Pros**:
|
|
233
|
+
- True real-time synchronization
|
|
234
|
+
- Works with massive numbers of tools
|
|
235
|
+
- Efficient, lightweight protocol
|
|
236
|
+
- Established standard (MQTT 5.0)
|
|
237
|
+
|
|
238
|
+
**Cons**:
|
|
239
|
+
- Most tools don't natively speak MQTT
|
|
240
|
+
- Need adapters/bridges for non-MQTT tools
|
|
241
|
+
- broker infrastructure required
|
|
242
|
+
|
|
243
|
+
**Complexity**: High
|
|
244
|
+
**Cost**: Medium
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Solution 10: Comprehensive Sync Platform (KONTEXT Cloud)
|
|
249
|
+
|
|
250
|
+
**Approach**: Build a full-featured cloud platform with MCP integration, web dashboard, and universal API.
|
|
251
|
+
|
|
252
|
+
**How it works**:
|
|
253
|
+
- Cloud-hosted backend (or self-hosted)
|
|
254
|
+
- MCP server as one integration option
|
|
255
|
+
- REST and GraphQL APIs for all tools
|
|
256
|
+
- Webhooks for event-driven updates
|
|
257
|
+
- Browser extension for web AI tools
|
|
258
|
+
- CLI for terminal-based tools
|
|
259
|
+
- Mobile app for mobile access
|
|
260
|
+
- Real-time sync across all devices
|
|
261
|
+
|
|
262
|
+
**Pros**:
|
|
263
|
+
- Complete solution - every integration covered
|
|
264
|
+
- Cloud sync - works from anywhere
|
|
265
|
+
- Professional grade
|
|
266
|
+
- User dashboard for management
|
|
267
|
+
|
|
268
|
+
**Cons**:
|
|
269
|
+
- Most complex to build
|
|
270
|
+
- Ongoing hosting costs
|
|
271
|
+
- Maintenance burden
|
|
272
|
+
|
|
273
|
+
**Complexity**: Very High
|
|
274
|
+
**Cost**: High
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Recommended Hybrid Solution: MCP + Webhook/Browser Extension + Local GraphQL API
|
|
279
|
+
|
|
280
|
+
Given the requirements, here's the recommended approach:
|
|
281
|
+
|
|
282
|
+
### Components
|
|
283
|
+
|
|
284
|
+
1. **MCP Server** - For Claude, Cursor, Antigravity, and any MCP-capable AI tools
|
|
285
|
+
2. **Local GraphQL API** - Acts as the central data layer, storing context in SQLite
|
|
286
|
+
3. **Browser Extension** - Injects context into ChatGPT, Gemini, and other web AI tools
|
|
287
|
+
4. **Webhook Server** - Pushes updates to registered tools in real-time
|
|
288
|
+
|
|
289
|
+
### Architecture Overview
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
293
|
+
│ MCP Tools │ │ Web Tools │ │ CLI Tools │
|
|
294
|
+
│ (Claude, │ │ (ChatGPT, │ │ (Terminal AI │
|
|
295
|
+
│ Cursor) │ │ Gemini) │ │ Assistants) │
|
|
296
|
+
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
|
|
297
|
+
│ │ │
|
|
298
|
+
▼ ▼ ▼
|
|
299
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
300
|
+
│ KONTEXT Core │
|
|
301
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
|
|
302
|
+
│ │ MCP Server │ │ GraphQL API │ │ Webhook Server │ │
|
|
303
|
+
│ └──────────────┘ └──────────────┘ └──────────────────┘ │
|
|
304
|
+
│ │ │
|
|
305
|
+
│ ┌───────▼───────┐ │
|
|
306
|
+
│ │ SQLite DB │ │
|
|
307
|
+
│ └───────────────┘ │
|
|
308
|
+
└──────────────────────────────────────────────────────────────┘
|
|
309
|
+
│ │ │
|
|
310
|
+
▼ ▼ ▼
|
|
311
|
+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
312
|
+
│ Desktop │ │ Browser │ │ Extensions │
|
|
313
|
+
│ Extensions │ │ Extension │ │ (VS Code, │
|
|
314
|
+
│ (native) │ │ (web tools) │ │ editors) │
|
|
315
|
+
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Implementation Steps
|
|
319
|
+
|
|
320
|
+
#### Step 1: Core Data Layer
|
|
321
|
+
|
|
322
|
+
**Description**: Build the SQLite database schema and basic read/write operations.
|
|
323
|
+
|
|
324
|
+
**Components**:
|
|
325
|
+
- SQLite database file (`kontEXT.db`)
|
|
326
|
+
- Tables: `context_files`, `skills`, `preferences`, `tool_configs`, `sync_log`
|
|
327
|
+
- Schema for versioned context with timestamps
|
|
328
|
+
|
|
329
|
+
**Success Criteria**:
|
|
330
|
+
- Database created and accessible
|
|
331
|
+
- CRUD operations working for all entity types
|
|
332
|
+
- Basic CLI tool can read/write context
|
|
333
|
+
|
|
334
|
+
#### Step 2: Local GraphQL API Server
|
|
335
|
+
|
|
336
|
+
**Description**: Create a GraphQL API that exposes all context operations.
|
|
337
|
+
|
|
338
|
+
**Components**:
|
|
339
|
+
- GraphQL schema (types: ContextFile, Skill, Preference, ToolConfig)
|
|
340
|
+
- Queries: getContext, getSkills, getPreferences
|
|
341
|
+
- Mutations: createContext, updateContext, deleteContext
|
|
342
|
+
- Subscriptions: onContextChange (for real-time updates)
|
|
343
|
+
|
|
344
|
+
**Success Criteria**:
|
|
345
|
+
- GraphQL server starts without errors
|
|
346
|
+
- All queries and mutations return expected data
|
|
347
|
+
- Subscriptions push updates to subscribers
|
|
348
|
+
|
|
349
|
+
#### Step 3: MCP Server Implementation
|
|
350
|
+
|
|
351
|
+
**Description**: Build an MCP server that connects to the GraphQL API.
|
|
352
|
+
|
|
353
|
+
**Components**:
|
|
354
|
+
- MCP server with context tools (read, write, list, search)
|
|
355
|
+
- Authentication with local API
|
|
356
|
+
- Bidirectional sync between MCP and GraphQL
|
|
357
|
+
|
|
358
|
+
**Success Criteria**:
|
|
359
|
+
- MCP server registers with Claude/Cursor
|
|
360
|
+
- Context loads correctly in test prompts
|
|
361
|
+
- Updates from MCP reflect in GraphQL API
|
|
362
|
+
|
|
363
|
+
#### Step 4: Webhook Server
|
|
364
|
+
|
|
365
|
+
**Description**: Implement a webhook system for event-driven updates.
|
|
366
|
+
|
|
367
|
+
**Components**:
|
|
368
|
+
- Webhook registration endpoint
|
|
369
|
+
- Event queue for context changes
|
|
370
|
+
- Retry logic for failed deliveries
|
|
371
|
+
- Webhook payload format (JSON with context diff)
|
|
372
|
+
|
|
373
|
+
**Success Criteria**:
|
|
374
|
+
- Webhooks register successfully
|
|
375
|
+
- Events trigger webhook calls immediately
|
|
376
|
+
- Failed webhooks retry with backoff
|
|
377
|
+
|
|
378
|
+
#### Step 5: Browser Extension (Chrome/Firefox)
|
|
379
|
+
|
|
380
|
+
**Description**: Build browser extensions that inject context into web AI tools.
|
|
381
|
+
|
|
382
|
+
**Components**:
|
|
383
|
+
- Extension manifest and background script
|
|
384
|
+
- Content script for ChatGPT, Gemini web
|
|
385
|
+
- Popup for manual context management
|
|
386
|
+
- API client to connect to local GraphQL
|
|
387
|
+
- Context injection into page/forms
|
|
388
|
+
|
|
389
|
+
**Success Criteria**:
|
|
390
|
+
- Extension installs without errors
|
|
391
|
+
- Context appears in ChatGPT/Gemini inputs
|
|
392
|
+
- Context persists across page reloads
|
|
393
|
+
- Extension syncs changes back to API
|
|
394
|
+
|
|
395
|
+
#### Step 6: CLI Tool
|
|
396
|
+
|
|
397
|
+
**Description**: Create a command-line interface for terminal-based tools.
|
|
398
|
+
|
|
399
|
+
**Components**:
|
|
400
|
+
- `kontEXT` command with subcommands (read, write, list, sync)
|
|
401
|
+
- Output formatting (JSON, YAML, table)
|
|
402
|
+
- Integration examples for common tools
|
|
403
|
+
|
|
404
|
+
**Success Criteria**:
|
|
405
|
+
- CLI installs globally
|
|
406
|
+
- All commands work as expected
|
|
407
|
+
- Output parses correctly in scripts
|
|
408
|
+
|
|
409
|
+
#### Step 7: Sync Engine
|
|
410
|
+
|
|
411
|
+
**Description**: Implement the synchronization logic that keeps context consistent.
|
|
412
|
+
|
|
413
|
+
**Components**:
|
|
414
|
+
- Change detection (file watcher)
|
|
415
|
+
- Conflict resolution (last-write-wins, merge, manual)
|
|
416
|
+
- Sync status indicators
|
|
417
|
+
- Notification system
|
|
418
|
+
|
|
419
|
+
**Success Criteria**:
|
|
420
|
+
- File changes detect within 1 second
|
|
421
|
+
- Conflicts resolve correctly
|
|
422
|
+
- User notified of sync status
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Implementation Success Criteria Summary
|
|
427
|
+
|
|
428
|
+
| Step | Component | Key Success Metric |
|
|
429
|
+
|------|-----------|-------------------|
|
|
430
|
+
| 1 | Core Data Layer | SQLite operations complete |
|
|
431
|
+
| 2 | GraphQL API | All queries/mutations work |
|
|
432
|
+
| 3 | MCP Server | Context loads in Claude/Cursor |
|
|
433
|
+
| 4 | Webhook Server | Events trigger webhooks |
|
|
434
|
+
| 5 | Browser Extension | Context injects in web tools |
|
|
435
|
+
| 6 | CLI Tool | Commands execute correctly |
|
|
436
|
+
| 7 | Sync Engine | Changes sync within 1 second |
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## Future Considerations (Post-MVP)
|
|
441
|
+
|
|
442
|
+
- **Cloud sync**: Add optional cloud hosting for cross-device sync
|
|
443
|
+
- **Encryption**: End-to-end encryption for sensitive context
|
|
444
|
+
- **Multi-user**: Support for teams sharing context
|
|
445
|
+
- **Analytics**: Usage patterns and insights
|
|
446
|
+
- **Plugins**: Third-party extension system
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/bin/start.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
4
|
+
console.log('Starting KONTEXT services...\n');
|
|
5
|
+
const services = [
|
|
6
|
+
{ name: 'GraphQL API', script: 'dist/graphql/server.js' },
|
|
7
|
+
{ name: 'MCP Server', script: 'dist/mcp/server.js' },
|
|
8
|
+
{ name: 'Webhook Server', script: 'dist/webhooks/server.js' },
|
|
9
|
+
{ name: 'Sync Engine', script: 'dist/sync/engine.js' },
|
|
10
|
+
];
|
|
11
|
+
const processes = [];
|
|
12
|
+
for (const service of services) {
|
|
13
|
+
const child = (0, child_process_1.spawn)('node', [service.script], {
|
|
14
|
+
cwd: process.cwd(),
|
|
15
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
16
|
+
});
|
|
17
|
+
child.stdout?.on('data', (data) => {
|
|
18
|
+
console.log(`[${service.name}] ${data.toString().trim()}`);
|
|
19
|
+
});
|
|
20
|
+
child.stderr?.on('data', (data) => {
|
|
21
|
+
console.error(`[${service.name}] ${data.toString().trim()}`);
|
|
22
|
+
});
|
|
23
|
+
processes.push(child);
|
|
24
|
+
console.log(`Started ${service.name}`);
|
|
25
|
+
}
|
|
26
|
+
console.log('\nAll services running!');
|
|
27
|
+
console.log('GraphQL API: http://localhost:4000');
|
|
28
|
+
console.log('Webhook Server: http://localhost:4001');
|
|
29
|
+
process.on('SIGINT', () => {
|
|
30
|
+
console.log('\nShutting down...');
|
|
31
|
+
processes.forEach((p) => p.kill());
|
|
32
|
+
process.exit(0);
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/bin/start.ts"],"names":[],"mappings":";;AAAA,iDAAsC;AAGtC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAE9C,MAAM,QAAQ,GAAG;IACf,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,wBAAwB,EAAE;IACzD,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,oBAAoB,EAAE;IACpD,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,yBAAyB,EAAE;IAC7D,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,qBAAqB,EAAE;CACvD,CAAC;AAEF,MAAM,SAAS,GAA+B,EAAE,CAAC;AAEjD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC5C,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC,CAAC;IAEH,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QAChC,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QAChC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AACzC,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AACvC,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AAClD,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;AAErD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|