@myrialabs/clopen 0.4.38 → 0.4.40

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 (177) hide show
  1. package/backend/auth/permissions.ts +48 -0
  2. package/backend/chat/stream-manager.ts +1 -1
  3. package/backend/database/crypto/secret-columns.ts +9 -1
  4. package/backend/database/migrations/075_create_deploy_bindings.ts +54 -0
  5. package/backend/database/migrations/076_remove_memory_code_graph.ts +229 -0
  6. package/backend/database/migrations/077_create_integration_db_links.ts +150 -0
  7. package/backend/database/migrations/078_create_worktree_branch_tables.ts +158 -0
  8. package/backend/database/migrations/index.ts +28 -0
  9. package/backend/database/queries/db-client-connection-queries.ts +19 -0
  10. package/backend/database/queries/deploy-queries.ts +124 -0
  11. package/backend/database/queries/graph-queries.ts +291 -247
  12. package/backend/database/queries/index.ts +10 -0
  13. package/backend/database/queries/integration-db-link-queries.ts +168 -0
  14. package/backend/database/queries/integration-queries.ts +34 -6
  15. package/backend/database/queries/worktree-branch-queries.ts +331 -0
  16. package/backend/db-client/cloning.test.ts +161 -0
  17. package/backend/db-client/cloning.ts +672 -0
  18. package/backend/db-client/connection-url.test.ts +117 -0
  19. package/backend/db-client/connection-url.ts +126 -0
  20. package/backend/db-client/drivers/mongodb.ts +2 -14
  21. package/backend/db-client/drivers/mysql.ts +2 -8
  22. package/backend/db-client/drivers/postgres.ts +10 -13
  23. package/backend/db-client/drivers/redis.ts +2 -6
  24. package/backend/db-client/env/detect.ts +438 -0
  25. package/backend/db-client/env/diff.ts +94 -0
  26. package/backend/db-client/env/env.test.ts +574 -0
  27. package/backend/db-client/env/index.ts +15 -0
  28. package/backend/db-client/env/naming.ts +202 -0
  29. package/backend/db-client/env/service.ts +487 -0
  30. package/backend/db-client/integrations/index.ts +44 -0
  31. package/backend/db-client/integrations/links.ts +564 -0
  32. package/backend/db-client/integrations/projector.test.ts +280 -0
  33. package/backend/db-client/integrations/projector.ts +256 -0
  34. package/backend/db-client/integrations/supabase-service.ts +266 -0
  35. package/backend/db-client/providers/neon/adapter.ts +522 -0
  36. package/backend/db-client/providers/neon/api-types.ts +182 -0
  37. package/backend/db-client/providers/neon/client.ts +298 -0
  38. package/backend/db-client/providers/neon/endpoints.test.ts +201 -0
  39. package/backend/db-client/providers/neon/endpoints.ts +314 -0
  40. package/backend/db-client/providers/neon/list.test.ts +181 -0
  41. package/backend/db-client/providers/registry.ts +27 -0
  42. package/backend/db-client/providers/supabase/adapter.ts +523 -0
  43. package/backend/db-client/providers/supabase/api-types.ts +92 -0
  44. package/backend/db-client/providers/supabase/apply-migration.ts +104 -0
  45. package/backend/db-client/providers/supabase/client.ts +259 -0
  46. package/backend/db-client/providers/supabase/features.ts +502 -0
  47. package/backend/db-client/providers/supabase/local.test.ts +78 -0
  48. package/backend/db-client/providers/supabase/local.ts +137 -0
  49. package/backend/db-client/providers/types.ts +194 -0
  50. package/backend/deployments/bindings.test.ts +43 -0
  51. package/backend/deployments/bindings.ts +216 -0
  52. package/backend/deployments/index.ts +53 -0
  53. package/backend/deployments/log-streams.ts +214 -0
  54. package/backend/deployments/prompts.ts +70 -0
  55. package/backend/deployments/providers/vercel/adapter.ts +757 -0
  56. package/backend/deployments/providers/vercel/build-logs.test.ts +80 -0
  57. package/backend/deployments/providers/vercel/build-logs.ts +211 -0
  58. package/backend/deployments/providers/vercel/client.ts +203 -0
  59. package/backend/deployments/providers/vercel/list.test.ts +624 -0
  60. package/backend/deployments/providers/vercel/normalise.test.ts +115 -0
  61. package/backend/deployments/providers/vercel/normalise.ts +113 -0
  62. package/backend/deployments/providers/vercel/types.ts +104 -0
  63. package/backend/deployments/registry.ts +27 -0
  64. package/backend/deployments/service.ts +458 -0
  65. package/backend/deployments/types.ts +278 -0
  66. package/backend/env-files/discovery.ts +48 -0
  67. package/backend/env-files/edit.ts +213 -0
  68. package/backend/env-files/env-files.test.ts +515 -0
  69. package/backend/env-files/git.ts +27 -0
  70. package/backend/env-files/index.ts +44 -0
  71. package/backend/env-files/keys.ts +69 -0
  72. package/backend/env-files/parse.ts +157 -0
  73. package/backend/env-files/write.ts +229 -0
  74. package/backend/index.ts +4 -0
  75. package/backend/integrations/health.ts +18 -4
  76. package/backend/integrations/projections/index.ts +0 -0
  77. package/backend/integrations/projections/mcp-projector.ts +7 -3
  78. package/backend/integrations/projections/types.ts +28 -9
  79. package/backend/integrations/registry/index.ts +8 -1
  80. package/backend/integrations/registry/providers/context7.ts +1 -0
  81. package/backend/integrations/registry/providers/firecrawl.ts +1 -0
  82. package/backend/integrations/registry/providers/github.ts +1 -0
  83. package/backend/integrations/registry/providers/neon.ts +55 -0
  84. package/backend/integrations/registry/providers/supabase.ts +62 -0
  85. package/backend/integrations/registry/providers/vercel.ts +47 -0
  86. package/backend/integrations/registry/types.ts +2 -0
  87. package/backend/mcp/internal/servers/memory-graph/description.ts +3 -3
  88. package/backend/mcp/internal/servers/memory-graph/runner.ts +4 -9
  89. package/backend/mcp/internal/servers/memory-graph/schema.ts +0 -4
  90. package/backend/memory/README.md +57 -34
  91. package/backend/memory/compose.test.ts +3 -3
  92. package/backend/memory/compose.ts +6 -9
  93. package/backend/memory/config.ts +0 -5
  94. package/backend/memory/consolidate.ts +1 -2
  95. package/backend/memory/context.test.ts +8 -54
  96. package/backend/memory/context.ts +19 -25
  97. package/backend/memory/extract/episodic.ts +10 -12
  98. package/backend/memory/extract/index.ts +23 -52
  99. package/backend/memory/extract/scheduler.ts +3 -6
  100. package/backend/memory/index.ts +6 -5
  101. package/backend/memory/invalidate.ts +36 -48
  102. package/backend/memory/layout.ts +319 -130
  103. package/backend/memory/retention.ts +12 -42
  104. package/backend/memory/retrieval.eval.test.ts +2 -2
  105. package/backend/memory/retrieval.test.ts +228 -183
  106. package/backend/memory/retrieval.ts +22 -21
  107. package/backend/memory/revise.test.ts +62 -116
  108. package/backend/memory/revise.ts +0 -1
  109. package/backend/memory/view.ts +8 -5
  110. package/backend/snapshot/helpers.ts +35 -41
  111. package/backend/snapshot/snapshot-service.ts +90 -0
  112. package/backend/snapshot/turn-changes.test.ts +163 -0
  113. package/backend/snapshot/turn-changes.ts +131 -0
  114. package/backend/work/start-work.ts +4 -0
  115. package/backend/worktrees/branching/engine.ts +557 -0
  116. package/backend/worktrees/branching/index.ts +56 -0
  117. package/backend/worktrees/branching/naming.test.ts +118 -0
  118. package/backend/worktrees/branching/naming.ts +97 -0
  119. package/backend/worktrees/branching/projector.test.ts +229 -0
  120. package/backend/worktrees/branching/projector.ts +139 -0
  121. package/backend/worktrees/branching/providers/neon.ts +220 -0
  122. package/backend/worktrees/branching/registry.ts +27 -0
  123. package/backend/worktrees/branching/service.ts +620 -0
  124. package/backend/worktrees/branching/suggest.test.ts +154 -0
  125. package/backend/worktrees/branching/suggest.ts +202 -0
  126. package/backend/worktrees/branching/types.ts +88 -0
  127. package/backend/worktrees/index.ts +7 -0
  128. package/backend/worktrees/service.ts +48 -1
  129. package/backend/ws/db-client/accounts.ts +225 -0
  130. package/backend/ws/db-client/connections.ts +34 -3
  131. package/backend/ws/db-client/context.ts +37 -0
  132. package/backend/ws/db-client/env.ts +142 -0
  133. package/backend/ws/db-client/index.ts +22 -1
  134. package/backend/ws/db-client/supabase.ts +188 -0
  135. package/backend/ws/deployments/actions.ts +360 -0
  136. package/backend/ws/deployments/context.ts +43 -0
  137. package/backend/ws/deployments/crud.ts +152 -0
  138. package/backend/ws/deployments/index.ts +15 -0
  139. package/backend/ws/deployments/schemas.ts +183 -0
  140. package/backend/ws/index.ts +6 -2
  141. package/backend/ws/memory/crud.ts +4 -16
  142. package/backend/ws/projects/index.ts +6 -1
  143. package/backend/ws/projects/info.ts +70 -6
  144. package/backend/ws/projects/overview.test.ts +108 -0
  145. package/backend/ws/projects/overview.ts +300 -0
  146. package/backend/ws/snapshot/changes.ts +279 -0
  147. package/backend/ws/snapshot/index.ts +4 -3
  148. package/backend/ws/system/device-info.ts +307 -76
  149. package/backend/ws/worktrees/branching.ts +212 -0
  150. package/backend/ws/worktrees/crud.ts +33 -7
  151. package/backend/ws/worktrees/index.ts +14 -0
  152. package/dist/assets/{index-DSHIANSy.js → index-D4igjF6e.js} +1 -1
  153. package/dist/assets/{index-CyH7fSbR.js → index-DONNwiXm.js} +1 -1
  154. package/dist/assets/main-BrfXH1bL.js +1205 -0
  155. package/dist/assets/main-CT1PygsW.css +1 -0
  156. package/dist/index.html +2 -2
  157. package/package.json +1 -1
  158. package/shared/constants/tool-icons.ts +13 -0
  159. package/shared/types/db-client/connection.ts +6 -0
  160. package/shared/types/db-client/env.ts +192 -0
  161. package/shared/types/db-client/index.ts +3 -0
  162. package/shared/types/db-client/integrations.ts +204 -0
  163. package/shared/types/db-client/supabase.ts +131 -0
  164. package/shared/types/deployments.ts +382 -0
  165. package/shared/types/integrations.ts +9 -0
  166. package/shared/types/memory.ts +34 -51
  167. package/shared/types/ui/components.ts +1 -1
  168. package/shared/types/worktree-branching.ts +315 -0
  169. package/shared/utils/diff-calculator.test.ts +89 -0
  170. package/shared/utils/diff-calculator.ts +30 -65
  171. package/shared/utils/logger.ts +2 -0
  172. package/backend/memory/extract/languages.ts +0 -176
  173. package/backend/memory/extract/structural.test.ts +0 -215
  174. package/backend/memory/extract/structural.ts +0 -364
  175. package/backend/ws/snapshot/content.ts +0 -85
  176. package/dist/assets/main-D2IOjftb.css +0 -1
  177. package/dist/assets/main-DM-tHKbW.js +0 -1152
@@ -73,6 +73,10 @@ import * as migration071 from './071_create_notes_tables';
73
73
  import * as migration072 from './072_encrypt_stored_secrets';
74
74
  import * as migration073 from './073_create_integration_tables';
75
75
  import * as migration074 from './074_create_work_tables';
76
+ import * as migration075 from './075_create_deploy_bindings';
77
+ import * as migration076 from './076_remove_memory_code_graph';
78
+ import * as migration077 from './077_create_integration_db_links';
79
+ import * as migration078 from './078_create_worktree_branch_tables';
76
80
 
77
81
  // Export all migrations in order
78
82
  export const migrations = [
@@ -519,6 +523,30 @@ export const migrations = [
519
523
  description: migration074.description,
520
524
  up: migration074.up,
521
525
  down: migration074.down
526
+ },
527
+ {
528
+ id: '075',
529
+ description: migration075.description,
530
+ up: migration075.up,
531
+ down: migration075.down
532
+ },
533
+ {
534
+ id: '076',
535
+ description: migration076.description,
536
+ up: migration076.up,
537
+ down: migration076.down
538
+ },
539
+ {
540
+ id: '077',
541
+ description: migration077.description,
542
+ up: migration077.up,
543
+ down: migration077.down
544
+ },
545
+ {
546
+ id: '078',
547
+ description: migration078.description,
548
+ up: migration078.up,
549
+ down: migration078.down
522
550
  }
523
551
  ];
524
552
 
@@ -341,6 +341,25 @@ export const dbClientConnectionQueries = {
341
341
  return redactConnectionSecrets(updated);
342
342
  },
343
343
 
344
+ /**
345
+ * Write the password exactly, including clearing it.
346
+ *
347
+ * `update()` treats an empty password as "the field was not re-typed" and
348
+ * keeps what is stored, which is right for a form and wrong for a
349
+ * projection: a derived row must equal what it was derived FROM, and
350
+ * releasing an adopted row back to a user who never set a password has to
351
+ * remove ours rather than leave it behind. This is that path, and it exists
352
+ * for the integration projector alone.
353
+ */
354
+ replacePassword(id: string, password: string | null): void {
355
+ const db = getDatabase();
356
+ db.prepare('UPDATE db_client_connections SET password = ?, updated_at = ? WHERE id = ?').run(
357
+ sealFor(TABLE, 'password', password && password.length > 0 ? password : null),
358
+ new Date().toISOString(),
359
+ id
360
+ );
361
+ },
362
+
344
363
  delete(id: string): void {
345
364
  const db = getDatabase();
346
365
  db.prepare('DELETE FROM db_client_connections WHERE id = ?').run(id);
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Deployments surface queries — bindings only.
3
+ *
4
+ * This table holds no secret, so nothing here goes through the crypto layer: a
5
+ * locator is a provider project id and the config is two display preferences.
6
+ * The credential that reaches the provider always comes from
7
+ * `integration_accounts`.
8
+ *
9
+ * There is no second table. Unlike the Issues surface, which records which
10
+ * worktree someone opened for an issue, a deployment leaves nothing local
11
+ * behind that would outlive the remote record — so nothing about a deployment
12
+ * is persisted at all. See migration 075.
13
+ */
14
+
15
+ import { getDatabase } from '../index';
16
+ import type { DeployBindingConfig } from '$shared/types/deployments';
17
+ import { DEFAULT_DEPLOY_BINDING_CONFIG } from '$shared/types/deployments';
18
+
19
+ export interface DeployBindingRow {
20
+ project_id: string;
21
+ account_id: string;
22
+ locator: string;
23
+ display_name: string;
24
+ team_id: string | null;
25
+ detected: number;
26
+ config_json: string;
27
+ created_at: string;
28
+ updated_at: string;
29
+ }
30
+
31
+ /**
32
+ * Parse the stored config over the defaults.
33
+ *
34
+ * Merged rather than replaced for the reason `parseBindingConfig` is: a config
35
+ * written before an option existed must not read back with that option
36
+ * `undefined`, or `environment` becomes a filter nothing matches and the list
37
+ * renders empty on a project that has deployments.
38
+ */
39
+ export function parseDeployConfig(raw: string | null): DeployBindingConfig {
40
+ if (!raw) return { ...DEFAULT_DEPLOY_BINDING_CONFIG };
41
+ try {
42
+ const parsed = JSON.parse(raw) as Partial<DeployBindingConfig> | null;
43
+ return { ...DEFAULT_DEPLOY_BINDING_CONFIG, ...(parsed ?? {}) };
44
+ } catch {
45
+ return { ...DEFAULT_DEPLOY_BINDING_CONFIG };
46
+ }
47
+ }
48
+
49
+ export const deployBindingQueries = {
50
+ getForProject(projectId: string): DeployBindingRow[] {
51
+ const db = getDatabase();
52
+ return db.prepare(
53
+ `SELECT * FROM deploy_bindings WHERE project_id = ?`
54
+ ).all(projectId) as DeployBindingRow[];
55
+ },
56
+
57
+ get(projectId: string, accountId: string): DeployBindingRow | null {
58
+ const db = getDatabase();
59
+ return db.prepare(
60
+ `SELECT * FROM deploy_bindings WHERE project_id = ? AND account_id = ?`
61
+ ).get(projectId, accountId) as DeployBindingRow | null;
62
+ },
63
+
64
+ upsert(input: {
65
+ projectId: string;
66
+ accountId: string;
67
+ locator: string;
68
+ displayName: string;
69
+ teamId: string | null;
70
+ detected: boolean;
71
+ config?: DeployBindingConfig;
72
+ }): DeployBindingRow {
73
+ const db = getDatabase();
74
+ const now = new Date().toISOString();
75
+ const existing = this.get(input.projectId, input.accountId);
76
+
77
+ db.prepare(`
78
+ INSERT INTO deploy_bindings (
79
+ project_id, account_id, locator, display_name, team_id, detected,
80
+ config_json, created_at, updated_at
81
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
82
+ ON CONFLICT (project_id, account_id) DO UPDATE SET
83
+ locator = excluded.locator,
84
+ display_name = excluded.display_name,
85
+ team_id = excluded.team_id,
86
+ detected = excluded.detected,
87
+ config_json = excluded.config_json,
88
+ updated_at = excluded.updated_at
89
+ `).run(
90
+ input.projectId,
91
+ input.accountId,
92
+ input.locator,
93
+ input.displayName,
94
+ input.teamId,
95
+ input.detected ? 1 : 0,
96
+ JSON.stringify(input.config ?? parseDeployConfig(existing?.config_json ?? null)),
97
+ existing?.created_at ?? now,
98
+ now
99
+ );
100
+
101
+ return this.get(input.projectId, input.accountId)!;
102
+ },
103
+
104
+ /**
105
+ * Store the config alone.
106
+ *
107
+ * Separate from `upsert` so toggling auto-refresh cannot clobber a locator
108
+ * the user repointed while the toggle was in flight — the same race
109
+ * `setDefaultBranch` avoids on the Issues side.
110
+ */
111
+ setConfig(projectId: string, accountId: string, config: DeployBindingConfig): void {
112
+ const db = getDatabase();
113
+ db.prepare(
114
+ `UPDATE deploy_bindings SET config_json = ?, updated_at = ? WHERE project_id = ? AND account_id = ?`
115
+ ).run(JSON.stringify(config), new Date().toISOString(), projectId, accountId);
116
+ },
117
+
118
+ remove(projectId: string, accountId: string): void {
119
+ const db = getDatabase();
120
+ db.prepare(
121
+ `DELETE FROM deploy_bindings WHERE project_id = ? AND account_id = ?`
122
+ ).run(projectId, accountId);
123
+ }
124
+ };