@myrialabs/clopen 0.4.37 → 0.4.39
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/README.md +2 -2
- package/backend/auth/permissions.ts +39 -0
- package/backend/bootstrap.ts +16 -0
- package/backend/chat/stream-manager.ts +1 -1
- package/backend/database/crypto/envelope.test.ts +93 -0
- package/backend/database/crypto/envelope.ts +127 -0
- package/backend/database/crypto/index.ts +22 -0
- package/backend/database/crypto/master-key.ts +129 -0
- package/backend/database/crypto/secret-columns.ts +151 -0
- package/backend/database/migrations/071_create_notes_tables.ts +90 -0
- package/backend/database/migrations/072_encrypt_stored_secrets.ts +107 -0
- package/backend/database/migrations/073_create_integration_tables.ts +119 -0
- package/backend/database/migrations/074_create_work_tables.ts +94 -0
- package/backend/database/migrations/075_create_deploy_bindings.ts +54 -0
- package/backend/database/migrations/076_remove_memory_code_graph.ts +229 -0
- package/backend/database/migrations/077_create_integration_db_links.ts +150 -0
- package/backend/database/migrations/index.ts +49 -0
- package/backend/database/queries/db-client-connection-queries.ts +42 -12
- package/backend/database/queries/deploy-queries.ts +124 -0
- package/backend/database/queries/engine-queries.ts +23 -10
- package/backend/database/queries/graph-queries.ts +291 -247
- package/backend/database/queries/index.ts +10 -1
- package/backend/database/queries/integration-db-link-queries.ts +168 -0
- package/backend/database/queries/integration-queries.ts +325 -0
- package/backend/database/queries/mcp-server-queries.ts +38 -11
- package/backend/database/queries/note-queries.test.ts +190 -0
- package/backend/database/queries/note-queries.ts +269 -0
- package/backend/database/queries/profile-queries.ts +1 -1
- package/backend/database/queries/ssh-connection-queries.ts +19 -8
- package/backend/database/queries/work-queries.ts +210 -0
- package/backend/db-client/integrations/index.ts +37 -0
- package/backend/db-client/integrations/links.ts +533 -0
- package/backend/db-client/integrations/projector.test.ts +280 -0
- package/backend/db-client/integrations/projector.ts +256 -0
- package/backend/db-client/integrations/supabase-service.ts +266 -0
- package/backend/db-client/providers/registry.ts +27 -0
- package/backend/db-client/providers/supabase/adapter.ts +500 -0
- package/backend/db-client/providers/supabase/api-types.ts +92 -0
- package/backend/db-client/providers/supabase/apply-migration.ts +104 -0
- package/backend/db-client/providers/supabase/client.ts +259 -0
- package/backend/db-client/providers/supabase/features.ts +502 -0
- package/backend/db-client/providers/supabase/local.test.ts +78 -0
- package/backend/db-client/providers/supabase/local.ts +137 -0
- package/backend/db-client/providers/types.ts +137 -0
- package/backend/deployments/bindings.test.ts +43 -0
- package/backend/deployments/bindings.ts +216 -0
- package/backend/deployments/index.ts +53 -0
- package/backend/deployments/log-streams.ts +214 -0
- package/backend/deployments/prompts.ts +70 -0
- package/backend/deployments/providers/vercel/adapter.ts +757 -0
- package/backend/deployments/providers/vercel/build-logs.test.ts +80 -0
- package/backend/deployments/providers/vercel/build-logs.ts +211 -0
- package/backend/deployments/providers/vercel/client.ts +203 -0
- package/backend/deployments/providers/vercel/list.test.ts +624 -0
- package/backend/deployments/providers/vercel/normalise.test.ts +115 -0
- package/backend/deployments/providers/vercel/normalise.ts +113 -0
- package/backend/deployments/providers/vercel/types.ts +104 -0
- package/backend/deployments/registry.ts +27 -0
- package/backend/deployments/service.ts +458 -0
- package/backend/deployments/types.ts +278 -0
- package/backend/engine/docs/artifacts.md +22 -9
- package/backend/files/os-clipboard.test.ts +209 -0
- package/backend/files/os-clipboard.ts +567 -0
- package/backend/http/integration-hooks.ts +42 -0
- package/backend/http/notes-images.test.ts +228 -0
- package/backend/http/notes-images.ts +196 -0
- package/backend/index.ts +13 -0
- package/backend/integrations/accounts.ts +229 -0
- package/backend/integrations/health.ts +146 -0
- package/backend/integrations/index.ts +36 -0
- package/backend/integrations/projections/index.ts +0 -0
- package/backend/integrations/projections/mcp-projector.test.ts +204 -0
- package/backend/integrations/projections/mcp-projector.ts +163 -0
- package/backend/integrations/projections/types.ts +63 -0
- package/backend/integrations/registry/define.ts +38 -0
- package/backend/integrations/registry/index.ts +60 -0
- package/backend/integrations/registry/providers/context7.ts +44 -0
- package/backend/integrations/registry/providers/firecrawl.ts +41 -0
- package/backend/integrations/registry/providers/github.ts +78 -0
- package/backend/integrations/registry/providers/supabase.ts +61 -0
- package/backend/integrations/registry/providers/vercel.ts +46 -0
- package/backend/integrations/registry/types.ts +96 -0
- package/backend/integrations/webhooks/gateway.ts +160 -0
- package/backend/integrations/webhooks/verify.ts +65 -0
- package/backend/mcp/README.md +25 -3
- package/backend/mcp/external/config.ts +35 -1
- package/backend/mcp/index.ts +1 -1
- package/backend/mcp/internal/config.ts +1 -1
- package/backend/mcp/internal/servers/memory-graph/description.ts +3 -3
- package/backend/mcp/internal/servers/memory-graph/runner.ts +4 -9
- package/backend/mcp/internal/servers/memory-graph/schema.ts +0 -4
- package/backend/memory/README.md +57 -34
- package/backend/memory/compose.test.ts +3 -3
- package/backend/memory/compose.ts +6 -9
- package/backend/memory/config.ts +0 -5
- package/backend/memory/consolidate.ts +1 -2
- package/backend/memory/context.test.ts +8 -54
- package/backend/memory/context.ts +19 -25
- package/backend/memory/extract/episodic.ts +10 -12
- package/backend/memory/extract/index.ts +23 -52
- package/backend/memory/extract/scheduler.ts +3 -6
- package/backend/memory/index.ts +6 -5
- package/backend/memory/invalidate.ts +36 -48
- package/backend/memory/layout.ts +319 -130
- package/backend/memory/retention.ts +12 -42
- package/backend/memory/retrieval.eval.test.ts +2 -2
- package/backend/memory/retrieval.test.ts +228 -183
- package/backend/memory/retrieval.ts +22 -21
- package/backend/memory/revise.test.ts +62 -116
- package/backend/memory/revise.ts +0 -1
- package/backend/memory/view.ts +8 -5
- package/backend/notes/access.test.ts +82 -0
- package/backend/notes/access.ts +27 -0
- package/backend/notes/storage.test.ts +77 -0
- package/backend/notes/storage.ts +114 -0
- package/backend/permissions/service.ts +2 -2
- package/backend/profiles/service.ts +1 -1
- package/backend/projects/project-cleanup.ts +6 -0
- package/backend/snapshot/helpers.ts +35 -41
- package/backend/snapshot/snapshot-service.ts +90 -0
- package/backend/snapshot/turn-changes.test.ts +163 -0
- package/backend/snapshot/turn-changes.ts +131 -0
- package/backend/work/bindings.ts +124 -0
- package/backend/work/index.ts +42 -0
- package/backend/work/prompts.ts +150 -0
- package/backend/work/providers/github/actions-logs.ts +180 -0
- package/backend/work/providers/github/adapter.test.ts +88 -0
- package/backend/work/providers/github/adapter.ts +1255 -0
- package/backend/work/providers/github/client.ts +280 -0
- package/backend/work/providers/github/list-range.test.ts +158 -0
- package/backend/work/providers/github/token-kind.test.ts +42 -0
- package/backend/work/pull-requests.ts +242 -0
- package/backend/work/registry.ts +27 -0
- package/backend/work/service.ts +436 -0
- package/backend/work/start-work.test.ts +71 -0
- package/backend/work/start-work.ts +232 -0
- package/backend/work/types.ts +180 -0
- package/backend/ws/db-client/accounts.ts +225 -0
- package/backend/ws/db-client/connections.ts +34 -3
- package/backend/ws/db-client/context.ts +37 -0
- package/backend/ws/db-client/index.ts +20 -1
- package/backend/ws/db-client/supabase.ts +188 -0
- package/backend/ws/deployments/actions.ts +360 -0
- package/backend/ws/deployments/context.ts +43 -0
- package/backend/ws/deployments/crud.ts +152 -0
- package/backend/ws/deployments/index.ts +15 -0
- package/backend/ws/deployments/schemas.ts +183 -0
- package/backend/ws/files/clipboard.ts +78 -0
- package/backend/ws/files/index.ts +5 -0
- package/backend/ws/git/diff-budget.ts +70 -11
- package/backend/ws/index.ts +16 -2
- package/backend/ws/integrations/crud.ts +219 -0
- package/backend/ws/integrations/index.ts +22 -0
- package/backend/ws/mcp/crud.ts +25 -1
- package/backend/ws/memory/crud.ts +4 -16
- package/backend/ws/notes/index.ts +278 -0
- package/backend/ws/profiles/crud.ts +1 -1
- package/backend/ws/snapshot/changes.ts +279 -0
- package/backend/ws/snapshot/index.ts +4 -3
- package/backend/ws/work/actions.ts +206 -0
- package/backend/ws/work/context.ts +51 -0
- package/backend/ws/work/crud.ts +347 -0
- package/backend/ws/work/index.ts +17 -0
- package/backend/ws/work/pull-requests.ts +177 -0
- package/backend/ws/work/schemas.ts +226 -0
- package/dist/assets/{index-sJmS_CCm.js → index-BrF6nqld.js} +1 -1
- package/dist/assets/{index-Bik9TCBi.js → index-C8Gi-b6U.js} +1 -1
- package/dist/assets/main-Bd3gb79F.css +1 -0
- package/dist/assets/main-Bo1hD7mt.js +1191 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/shared/constants/engine-tools.ts +1 -1
- package/shared/constants/tool-icons.ts +42 -0
- package/shared/types/database/schema.ts +41 -0
- package/shared/types/db-client/connection.ts +6 -0
- package/shared/types/db-client/index.ts +2 -0
- package/shared/types/db-client/integrations.ts +174 -0
- package/shared/types/db-client/supabase.ts +131 -0
- package/shared/types/deployments.ts +382 -0
- package/shared/types/integrations.ts +140 -0
- package/shared/types/memory.ts +34 -51
- package/shared/types/stores/settings.ts +8 -0
- package/shared/types/ui/components.ts +1 -1
- package/shared/types/work.ts +426 -0
- package/shared/utils/diff-calculator.test.ts +89 -0
- package/shared/utils/diff-calculator.ts +30 -65
- package/shared/utils/logger.ts +4 -0
- package/backend/memory/extract/languages.ts +0 -176
- package/backend/memory/extract/structural.test.ts +0 -215
- package/backend/memory/extract/structural.ts +0 -364
- package/backend/ws/snapshot/content.ts +0 -85
- package/dist/assets/main-DLqolBI2.css +0 -1
- package/dist/assets/main-Df1I3hnw.js +0 -1096
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import type { EngineType } from '$shared/types/unified';
|
|
17
17
|
import { getDatabase } from '../index';
|
|
18
|
+
import { openRow, sealFor } from '../crypto';
|
|
18
19
|
|
|
19
20
|
// ============================================================================
|
|
20
21
|
// Types
|
|
@@ -50,6 +51,15 @@ export interface EngineProviderWithAccounts extends EngineProvider {
|
|
|
50
51
|
// Queries
|
|
51
52
|
// ============================================================================
|
|
52
53
|
|
|
54
|
+
// `engine_accounts.credential` is sealed at rest (see backend/database/crypto).
|
|
55
|
+
// Every account read opens it, so the adapters keep receiving the raw token.
|
|
56
|
+
const ACCOUNTS_TABLE = 'engine_accounts';
|
|
57
|
+
|
|
58
|
+
/** Open the sealed credential on a row straight out of SQLite. */
|
|
59
|
+
function openAccount<T extends EngineAccount | null>(row: T): T {
|
|
60
|
+
return (row ? openRow(ACCOUNTS_TABLE, row) : row) as T;
|
|
61
|
+
}
|
|
62
|
+
|
|
53
63
|
export const engineQueries = {
|
|
54
64
|
// ------------------------------------------------------------------
|
|
55
65
|
// Providers
|
|
@@ -150,21 +160,21 @@ export const engineQueries = {
|
|
|
150
160
|
|
|
151
161
|
getAccount(id: number): EngineAccount | null {
|
|
152
162
|
const db = getDatabase();
|
|
153
|
-
return db.prepare(`SELECT * FROM engine_accounts WHERE id = ?`).get(id) as EngineAccount | null;
|
|
163
|
+
return openAccount(db.prepare(`SELECT * FROM engine_accounts WHERE id = ?`).get(id) as EngineAccount | null);
|
|
154
164
|
},
|
|
155
165
|
|
|
156
166
|
getAccountsByProvider(providerId: number): EngineAccount[] {
|
|
157
167
|
const db = getDatabase();
|
|
158
|
-
return db.prepare(
|
|
168
|
+
return (db.prepare(
|
|
159
169
|
`SELECT * FROM engine_accounts WHERE provider_id = ? ORDER BY created_at ASC`
|
|
160
|
-
).all(providerId) as EngineAccount[];
|
|
170
|
+
).all(providerId) as EngineAccount[]).map((row) => openAccount(row));
|
|
161
171
|
},
|
|
162
172
|
|
|
163
173
|
getActiveAccount(providerId: number): EngineAccount | null {
|
|
164
174
|
const db = getDatabase();
|
|
165
|
-
return db.prepare(
|
|
175
|
+
return openAccount(db.prepare(
|
|
166
176
|
`SELECT * FROM engine_accounts WHERE provider_id = ? AND is_active = 1`
|
|
167
|
-
).get(providerId) as EngineAccount | null;
|
|
177
|
+
).get(providerId) as EngineAccount | null);
|
|
168
178
|
},
|
|
169
179
|
|
|
170
180
|
/**
|
|
@@ -173,14 +183,14 @@ export const engineQueries = {
|
|
|
173
183
|
*/
|
|
174
184
|
getActiveAccountForEngine(engineType: EngineType): EngineAccount | null {
|
|
175
185
|
const db = getDatabase();
|
|
176
|
-
return db.prepare(`
|
|
186
|
+
return openAccount(db.prepare(`
|
|
177
187
|
SELECT a.*
|
|
178
188
|
FROM engine_accounts a
|
|
179
189
|
JOIN engine_providers p ON p.id = a.provider_id
|
|
180
190
|
WHERE p.engine_type = ? AND p.is_enabled = 1 AND a.is_active = 1
|
|
181
191
|
ORDER BY p.created_at ASC, a.created_at ASC
|
|
182
192
|
LIMIT 1
|
|
183
|
-
`).get(engineType) as EngineAccount | null;
|
|
193
|
+
`).get(engineType) as EngineAccount | null);
|
|
184
194
|
},
|
|
185
195
|
|
|
186
196
|
createAccount(providerId: number, name: string, credential: string): EngineAccount {
|
|
@@ -195,10 +205,10 @@ export const engineQueries = {
|
|
|
195
205
|
const result = db.prepare(`
|
|
196
206
|
INSERT INTO engine_accounts (provider_id, name, credential, is_active)
|
|
197
207
|
VALUES (?, ?, ?, ?)
|
|
198
|
-
`).run(providerId, name, credential, isActive) as { lastInsertRowid: number | bigint };
|
|
208
|
+
`).run(providerId, name, sealFor(ACCOUNTS_TABLE, 'credential', credential), isActive) as { lastInsertRowid: number | bigint };
|
|
199
209
|
|
|
200
210
|
const id = Number(result.lastInsertRowid);
|
|
201
|
-
return db.prepare(`SELECT * FROM engine_accounts WHERE id = ?`).get(id) as EngineAccount;
|
|
211
|
+
return openAccount(db.prepare(`SELECT * FROM engine_accounts WHERE id = ?`).get(id) as EngineAccount);
|
|
202
212
|
},
|
|
203
213
|
|
|
204
214
|
switchAccount(accountId: number): void {
|
|
@@ -242,7 +252,10 @@ export const engineQueries = {
|
|
|
242
252
|
*/
|
|
243
253
|
updateAccountCredential(accountId: number, credential: string): void {
|
|
244
254
|
const db = getDatabase();
|
|
245
|
-
db.prepare(`UPDATE engine_accounts SET credential = ? WHERE id = ?`).run(
|
|
255
|
+
db.prepare(`UPDATE engine_accounts SET credential = ? WHERE id = ?`).run(
|
|
256
|
+
sealFor(ACCOUNTS_TABLE, 'credential', credential),
|
|
257
|
+
accountId
|
|
258
|
+
);
|
|
246
259
|
},
|
|
247
260
|
|
|
248
261
|
// ------------------------------------------------------------------
|