@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
@@ -0,0 +1,382 @@
1
+ /**
2
+ * Deployments surface — shared vocabulary.
3
+ *
4
+ * The panel talks about DEPLOYMENTS, not about Vercel. Every provider that can
5
+ * offer the `deployments` capability is normalised into these shapes by an
6
+ * adapter, and the panel never learns which one answered. That is the whole
7
+ * test for this surface: if Netlify or Railway needs a second panel, these
8
+ * types are wrong and fixing them is the work — not adding a panel.
9
+ *
10
+ * Nothing here carries a credential. The adapter resolves the account's secret
11
+ * on the server and it never crosses this line.
12
+ */
13
+
14
+ /**
15
+ * The one state fact the UI is allowed to reason about.
16
+ *
17
+ * Providers name their states whatever they like — Vercel says `INITIALIZING`,
18
+ * `BUILDING`, `READY`; Netlify says `enqueued`, `building`, `ready`. The native
19
+ * name is shown verbatim in the detail pane, but colour, grouping and whether
20
+ * polling continues are decided from this normalised set alone. Anything in the
21
+ * frontend that reads a provider's own state string is a bug in the interface.
22
+ */
23
+ export type DeploymentState = 'queued' | 'building' | 'ready' | 'error' | 'canceled';
24
+
25
+ /**
26
+ * Which environment a deployment belongs to.
27
+ *
28
+ * `custom` exists because Vercel has custom environments and Netlify has branch
29
+ * deploys, and collapsing either into `preview` would make the filter lie.
30
+ */
31
+ export type DeploymentEnvironment = 'production' | 'preview' | 'custom';
32
+
33
+ /** What the list can be narrowed to. `all` is the absence of a filter. */
34
+ export type DeploymentEnvironmentFilter = DeploymentEnvironment | 'all';
35
+
36
+ export interface Deployment {
37
+ /** Opaque provider id. Used for API calls, never shown. */
38
+ id: string;
39
+ /** The project/app name the provider reports, for multi-project accounts. */
40
+ name: string;
41
+ /**
42
+ * Where this build can be reached, without a scheme.
43
+ *
44
+ * Null while a deployment is still uploading — Vercel documents `url` as
45
+ * null for an incomplete deployment, and rendering `https://null` is worse
46
+ * than rendering nothing.
47
+ */
48
+ url: string | null;
49
+ /** The provider's own dashboard page for this build. */
50
+ inspectorUrl: string | null;
51
+ state: DeploymentState;
52
+ /** The provider's own state name, shown as-is in the detail pane. */
53
+ stateDetail: string;
54
+ environment: DeploymentEnvironment;
55
+ /**
56
+ * True when this deployment is the one currently serving production traffic.
57
+ *
58
+ * Distinct from `state === 'ready' && environment === 'production'`: a
59
+ * production build that was superseded, or rolled back away from, is ready
60
+ * and production and yet serves nobody.
61
+ */
62
+ isCurrent: boolean;
63
+ /**
64
+ * The provider says this build can be rolled back to.
65
+ *
66
+ * NULLABLE on purpose. `false` and "the provider did not say" are different
67
+ * answers, and collapsing them into `false` HID the rollback action on every
68
+ * deployment whose listing omitted the field — the action existed and was
69
+ * simply unreachable. Null means fall back to what is knowable: a ready
70
+ * production build that is not the live one.
71
+ */
72
+ isRollbackCandidate: boolean | null;
73
+ branch: string | null;
74
+ commitSha: string | null;
75
+ commitMessage: string | null;
76
+ creator: string | null;
77
+ createdAt: string;
78
+ buildingAt: string | null;
79
+ readyAt: string | null;
80
+ /** Machine-readable failure cause, when the provider gives one. */
81
+ errorCode: string | null;
82
+ errorMessage: string | null;
83
+ /** How the build was triggered — `git`, `cli`, `redeploy`. */
84
+ source: string | null;
85
+ }
86
+
87
+ export interface DeploymentDetail extends Deployment {
88
+ /** Every hostname pointing at this build, production aliases included. */
89
+ aliases: string[];
90
+ /** Framework the provider detected, when it reports one. */
91
+ framework: string | null;
92
+ /** Build duration in milliseconds, when both ends are known. */
93
+ durationMs: number | null;
94
+ }
95
+
96
+ export interface DeploymentPage {
97
+ items: Deployment[];
98
+ hasMore: boolean;
99
+ /**
100
+ * Opaque cursor for the next page.
101
+ *
102
+ * A cursor rather than a page number because Vercel paginates by timestamp
103
+ * and a page number would silently skip or repeat rows whenever a build
104
+ * lands mid-scroll. Providers that page by number encode it in here.
105
+ */
106
+ nextCursor: string | null;
107
+ rateLimit: DeployRateLimit | null;
108
+ }
109
+
110
+ /** Budget left on the provider's API, shown in the footer. */
111
+ export interface DeployRateLimit {
112
+ remaining: number;
113
+ limit: number;
114
+ resetAt: string | null;
115
+ }
116
+
117
+ /**
118
+ * What a provider can actually do.
119
+ *
120
+ * Every optional action is a flag rather than a try-and-see, because the
121
+ * alternative is a button that exists on every provider and 404s on most of
122
+ * them. Coolify has no promote, Fly has no preview deployment, and both must
123
+ * render a panel with those controls absent rather than disabled.
124
+ */
125
+ export interface DeployProviderCapabilities {
126
+ /** Build logs can be read at all. */
127
+ logs: boolean;
128
+ /**
129
+ * A build can be STARTED from here, not merely repeated.
130
+ *
131
+ * Separate from `redeploy`, which needs an existing deployment to copy. A
132
+ * project that has never been deployed has nothing to redeploy, and without
133
+ * this the panel is a dead end for exactly the project someone most wants to
134
+ * get onto a host.
135
+ */
136
+ createDeployment: boolean;
137
+ /** A new remote project can be created from here. */
138
+ createProject: boolean;
139
+ /** A git repository can be attached to an existing remote project. */
140
+ connectRepository: boolean;
141
+ /** A deployment can be deleted outright. */
142
+ deleteDeployment: boolean;
143
+ /** Logs arrive as a live stream rather than one fetched bundle. */
144
+ streamLogs: boolean;
145
+ redeploy: boolean;
146
+ cancel: boolean;
147
+ rollback: boolean;
148
+ promote: boolean;
149
+ /** The provider distinguishes production from preview builds. */
150
+ environments: boolean;
151
+ /** The list can be narrowed to one git branch. */
152
+ branchFilter: boolean;
153
+ }
154
+
155
+ /** A remote project this account could be pointed at, for the binding picker. */
156
+ export interface DeployTarget {
157
+ /** Opaque provider id — `prj_…` on Vercel. Stored as the binding's locator. */
158
+ id: string;
159
+ name: string;
160
+ /** Team or organisation scope, when the provider has one. */
161
+ teamId: string | null;
162
+ teamName: string | null;
163
+ framework: string | null;
164
+ /** `owner/repo` of the connected git repository, used to detect a binding. */
165
+ gitRepo: string | null;
166
+ }
167
+
168
+ /**
169
+ * What starting a build needs to know, resolved when the deploy dialog opens.
170
+ *
171
+ * Fetched on demand rather than carried on every source: it costs a request,
172
+ * and the overwhelming majority of panel opens never start a build.
173
+ */
174
+ export interface DeployInfo {
175
+ /** `owner/repo` the remote project builds from, or null when it has none. */
176
+ gitRepo: string | null;
177
+ /** The branch that produces a production build. */
178
+ productionBranch: string | null;
179
+ /**
180
+ * Whether a build can be started at all, and why not when it cannot.
181
+ *
182
+ * A remote project with no git connection can only be deployed by uploading
183
+ * files, which is a CLI job — saying so is better than a button that fails.
184
+ */
185
+ canDeploy: boolean;
186
+ reason: string | null;
187
+ /**
188
+ * `owner/repo` read off the LOCAL project's git remote.
189
+ *
190
+ * Carried so the dialog can offer to connect it when the remote project has
191
+ * no repository — the answer is already sitting in the working tree, and
192
+ * making someone type it is the setup step that sends them to the dashboard.
193
+ */
194
+ suggestedRepo: string | null;
195
+ /**
196
+ * Whether attaching `suggestedRepo` would actually work.
197
+ *
198
+ * Three states, not a boolean, because a boolean forces the uncertain case
199
+ * to pretend. The first version answered `true` when the check itself could
200
+ * not be read — which put the button back on screen and let the failure
201
+ * arrive as a toast, defeating the point of checking at all.
202
+ *
203
+ * ready — verified; the button can be pressed
204
+ * blocked — verified as impossible; the button must NOT be offered
205
+ * unknown — the check could not be read; we cannot prove either way
206
+ * unavailable — nothing to connect, or the provider cannot connect
207
+ */
208
+ connectState: 'ready' | 'blocked' | 'unknown' | 'unavailable';
209
+ /** What to do about it, when it is not ready. */
210
+ connectHint: string | null;
211
+ /** Where to go to fix it — the provider's own settings page. */
212
+ connectUrl: string | null;
213
+ /**
214
+ * The branch checked out in the local project right now.
215
+ *
216
+ * Offered alongside the production branch, because the branch someone is
217
+ * working on is at least as likely to be the one they want to deploy — and
218
+ * retyping it from memory is how a preview gets built from the wrong ref.
219
+ */
220
+ currentBranch: string | null;
221
+ }
222
+
223
+ /** What a new build is made from. */
224
+ export interface DeploymentDraft {
225
+ /** Branch or tag to build. */
226
+ ref: string;
227
+ /** Production rather than preview. Always the more dangerous choice. */
228
+ production: boolean;
229
+ }
230
+
231
+ /** Defaults offered when creating a remote project, read from the local one. */
232
+ export interface NewProjectDefaults {
233
+ suggestedName: string;
234
+ /** `owner/repo` from this project's git remote, when it has one. */
235
+ gitRepo: string | null;
236
+ /** Provider the remote belongs to, as the target host names it. */
237
+ gitProvider: string | null;
238
+ }
239
+
240
+ export interface NewProjectDraft {
241
+ name: string;
242
+ gitRepo: string | null;
243
+ gitProvider: string | null;
244
+ framework: string | null;
245
+ }
246
+
247
+ /** Per-binding behaviour. Not a secret, stored as plain JSON. */
248
+ export interface DeployBindingConfig {
249
+ /** Which environment the list opens on. */
250
+ environment: DeploymentEnvironmentFilter;
251
+ /**
252
+ * Keep polling the list while a build is running.
253
+ *
254
+ * On by default and switchable off, because this is a metered remote API and
255
+ * a user on a rate-limited plan watching a long build may prefer to refresh
256
+ * by hand.
257
+ */
258
+ autoRefresh: boolean;
259
+ }
260
+
261
+ export const DEFAULT_DEPLOY_BINDING_CONFIG: DeployBindingConfig = {
262
+ environment: 'all',
263
+ autoRefresh: true
264
+ };
265
+
266
+ /** The remote project one account is pointed at, as the panel sees it. */
267
+ export interface DeployBinding {
268
+ locator: string;
269
+ /**
270
+ * Human name of the remote project.
271
+ *
272
+ * Cached on the binding rather than derived from the locator, because unlike
273
+ * an `owner/repo` a Vercel locator is `prj_8Qc…` and means nothing to anyone.
274
+ * A binding bar rendering the raw id would be unreadable.
275
+ */
276
+ displayName: string;
277
+ detected: boolean;
278
+ teamId: string | null;
279
+ config: DeployBindingConfig;
280
+ }
281
+
282
+ /** One connected account able to serve deployments here. */
283
+ export interface DeploySource {
284
+ accountId: string;
285
+ provider: string;
286
+ providerName: string;
287
+ label: string;
288
+ /**
289
+ * Who the stored credential belongs to.
290
+ *
291
+ * Resolved once per source rather than per view. Shown in the footer beside
292
+ * the provider mark, the way the Issues surface shows it — a panel acting on
293
+ * someone's account should say whose.
294
+ */
295
+ viewer: string | null;
296
+ capabilities: DeployProviderCapabilities;
297
+ binding: DeployBinding | null;
298
+ /** Remote projects detected for this project, offered before the full list. */
299
+ suggestedTargets: DeployTarget[];
300
+ status: 'ok' | 'needs_auth' | 'needs_config' | 'error' | 'unknown';
301
+ statusDetail: string | null;
302
+ }
303
+
304
+ /** Build log text, already budgeted to something a prompt can carry. */
305
+ export interface BuildLogBundle {
306
+ deploymentId: string;
307
+ text: string;
308
+ truncated: boolean;
309
+ }
310
+
311
+ /**
312
+ * An action that triggers a build or changes what is live.
313
+ *
314
+ * Named as a closed set so the confirm dialog, the capability flags and the
315
+ * route schema all agree on what exists. Every one of these is outward-facing
316
+ * and must be confirmed explicitly before it runs.
317
+ */
318
+ export type DeployAction = 'redeploy' | 'cancel' | 'rollback' | 'promote' | 'delete';
319
+
320
+ /**
321
+ * The outcome of an outward-facing action.
322
+ *
323
+ * `pending` is not a courtesy — rollback and promote are asynchronous on
324
+ * Vercel: the call returns once the request is accepted, while production
325
+ * traffic moves some seconds later. Reporting those as done would tell the user
326
+ * their incident is over before it is.
327
+ */
328
+ export interface DeployActionResult {
329
+ action: DeployAction;
330
+ status: 'done' | 'pending';
331
+ /** A new deployment id, when the action created one. */
332
+ deploymentId: string | null;
333
+ message: string;
334
+ }
335
+
336
+ /**
337
+ * Project-level state, which belongs to the target rather than to any build.
338
+ *
339
+ * Read separately from the deployment list because it answers a different
340
+ * question: not "how did this build go" but "will pushing even produce one".
341
+ */
342
+ export interface DeployProjectStatus {
343
+ /**
344
+ * The target is paused at the provider.
345
+ *
346
+ * READ-ONLY here on purpose. Clopen does not offer to pause: on Vercel it
347
+ * "blocks the active Production Deployment" — it takes the site down, not
348
+ * merely stops future builds — and that is a high-consequence, rarely-wanted
349
+ * action to reach from an editor. But if someone paused it in the provider's
350
+ * dashboard, this is the only thing that explains a list which has stopped
351
+ * growing and a site that has stopped answering.
352
+ */
353
+ paused: boolean;
354
+ /**
355
+ * A rollback or promotion the provider accepted and is still carrying out.
356
+ *
357
+ * This is what turns the `pending` an action returns into an outcome. Until
358
+ * it settles, production traffic has not moved yet.
359
+ */
360
+ aliasRequest: {
361
+ type: 'rollback' | 'promote';
362
+ status: 'pending' | 'in-progress' | 'succeeded' | 'failed' | 'skipped';
363
+ toDeploymentId: string | null;
364
+ } | null;
365
+ }
366
+
367
+ /** One chunk of a live build log, pushed to whoever asked to follow it. */
368
+ export interface BuildLogChunk {
369
+ streamId: string;
370
+ deploymentId: string;
371
+ data: string;
372
+ /**
373
+ * Stage the provider reports — `Building`, `Uploading`, `Deploying`.
374
+ *
375
+ * Carried separately from the text because a build spends long stretches
376
+ * printing nothing at all, and during those a reader cannot tell work from
377
+ * a stall. Pushed the moment it changes rather than on the flush interval.
378
+ */
379
+ phase?: string;
380
+ done?: boolean;
381
+ error?: string | null;
382
+ }
@@ -78,6 +78,15 @@ export interface IntegrationProviderInfo {
78
78
  category: IntegrationCategory;
79
79
  description: string;
80
80
  docsUrl?: string;
81
+ /**
82
+ * The provider's own dashboard.
83
+ *
84
+ * Separate from `docsUrl`, which points at where a CREDENTIAL is created.
85
+ * This is where the things Clopen cannot manage actually live — an
86
+ * organisation Neon has no API for, a billing plan — so a surface that has
87
+ * to say "do this at the vendor" can offer the trip instead of describing it.
88
+ */
89
+ consoleUrl?: string;
81
90
  authMethod: IntegrationAuthMethod;
82
91
  credentialFields: IntegrationCredentialField[];
83
92
  capabilities: IntegrationCapability[];
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * Memory Graph types.
3
3
  *
4
- * One graph holds both kinds of memory (see migration 066): `episodic` for what
5
- * happened and what was decided, `structural` for the codebase as entities. They
6
- * are connected by real edges, so a query can travel from a decision to the code
7
- * it governs and back.
4
+ * The graph holds MEMORIES: what happened, what was decided, what broke and how
5
+ * the user wants to work. It used to hold the codebase alongside them as nodes
6
+ * of its own (migration 066), which migration 076 removed — the agent can read
7
+ * the repository, and those nodes were four fifths of the store while never
8
+ * reaching a prompt. What survives of that half is `relatedPaths`: the files a
9
+ * memory claims something about, carried as an attribute of the memory.
8
10
  *
9
11
  * Shared between backend and frontend — the visualization, the MCP tool surface
10
12
  * and the retrieval engine all speak these shapes.
@@ -14,9 +16,7 @@
14
16
  // Nodes
15
17
  // ─────────────────────────────────────────────────────────────────────────────
16
18
 
17
- export type GraphNodeKind = 'episodic' | 'structural';
18
-
19
- /** What kind of memory an episodic node holds. */
19
+ /** What kind of memory a node holds. */
20
20
  export type EpisodicSubkind =
21
21
  | 'decision'
22
22
  | 'pattern'
@@ -25,10 +25,7 @@ export type EpisodicSubkind =
25
25
  | 'observation'
26
26
  | 'entity';
27
27
 
28
- /** What kind of code entity a structural node represents. */
29
- export type StructuralSubkind = 'file' | 'symbol' | 'module' | 'dependency';
30
-
31
- export type GraphNodeSubkind = EpisodicSubkind | StructuralSubkind;
28
+ export type GraphNodeSubkind = EpisodicSubkind;
32
29
 
33
30
  /**
34
31
  * How LONG a claim holds — its durability, not its geography.
@@ -103,7 +100,7 @@ export const AUTHORITY_RANK: Record<GraphAssertedBy, number> = {
103
100
  * distinction, because both are a model reading text and deciding what to store.
104
101
  * Meanwhile `auto` was doing the work of the real question every consumer
105
102
  * actually asks: *did a person say this, or did a model infer it?* Retention,
106
- * structural decay, consolidation and the trust line in the injected block all
103
+ * staleness decay, consolidation and the trust line in the injected block all
107
104
  * branch on precisely that. Two values answer it without ambiguity; three
108
105
  * invited every reader to guess which of the two model-written kinds a predicate
109
106
  * meant.
@@ -112,21 +109,22 @@ export type GraphSource = 'agent' | 'user';
112
109
 
113
110
  export interface GraphNode {
114
111
  id: string;
115
- kind: GraphNodeKind;
116
112
  subkind: GraphNodeSubkind;
117
113
  scope: GraphScope;
118
114
  projectId: string | null;
119
115
  sessionId: string | null;
120
116
  /** Short, human-readable title shown on the graph and in listings. */
121
117
  label: string;
122
- /** Full memory text, or a signature/summary for structural nodes. */
118
+ /** Full memory text. */
123
119
  body: string;
124
- /** Repo-relative path for structural nodes. */
125
- path: string | null;
126
- /** Symbol name for structural nodes of subkind `symbol`. */
127
- symbol: string | null;
128
- /** Detected language of the file a structural node came from. */
129
- language: string | null;
120
+ /**
121
+ * Repo-relative paths this memory claims something about.
122
+ *
123
+ * Loaded on demand — listings that draw thousands of nodes do not pay for it.
124
+ * This is what invalidation ages a memory against and what an anchored query
125
+ * seeds from, and it replaces the file nodes those two used to walk through.
126
+ */
127
+ relatedPaths?: string[];
130
128
  /** Stable identity hash used to upsert instead of duplicating. */
131
129
  digest: string;
132
130
  /** How much the writer trusts this memory, 0–1. */
@@ -160,7 +158,7 @@ export interface GraphNode {
160
158
  usefulCount: number;
161
159
  /** Times a later turn found this memory wrong or misleading. */
162
160
  unhelpfulCount: number;
163
- /** When the code this memory is `about` last changed underneath it. */
161
+ /** When code this memory claims something about last changed underneath it. */
164
162
  staleAt: string | null;
165
163
  /** Canonical identity for `entity` nodes — the slug every statement hangs off. */
166
164
  entityKey: string | null;
@@ -171,25 +169,18 @@ export interface GraphNode {
171
169
  // ─────────────────────────────────────────────────────────────────────────────
172
170
 
173
171
  /**
174
- * Relation types, grouped by what they connect.
172
+ * Relation types.
175
173
  *
176
- * `about` is the load-bearing one: it links an episodic memory to the code it
177
- * concerns, which is what fuses the two halves into a single graph instead of
178
- * two indexes in one database.
174
+ * All of them now connect one memory to another. The code-shaped relations
175
+ * (`imports`, `defines`, `contains`, and `about` pointing at a file node) went
176
+ * with the structural half in migration 076 — what a memory is about is a list
177
+ * of paths on the memory, not an edge to a node standing in for a file.
179
178
  */
180
179
  export type GraphRelation =
181
- // structural ↔ structural
182
- | 'imports'
183
- | 'calls'
184
- | 'defines'
185
- | 'contains'
186
- // episodic ↔ episodic
187
180
  | 'caused_by'
188
181
  | 'supersedes'
189
182
  | 'contradicts'
190
183
  | 'generalizes'
191
- // episodic → structural
192
- | 'about'
193
184
  // anything, drawn by hand
194
185
  | 'relates_to';
195
186
 
@@ -208,16 +199,12 @@ export interface GraphEdge {
208
199
  // ─────────────────────────────────────────────────────────────────────────────
209
200
 
210
201
  export interface GraphNodeInput {
211
- kind: GraphNodeKind;
212
202
  subkind: GraphNodeSubkind;
213
203
  scope?: GraphScope;
214
204
  projectId?: string | null;
215
205
  sessionId?: string | null;
216
206
  label: string;
217
207
  body?: string;
218
- path?: string | null;
219
- symbol?: string | null;
220
- language?: string | null;
221
208
  /** Supply to control identity; otherwise derived from the node's content. */
222
209
  digest?: string;
223
210
  confidence?: number;
@@ -291,9 +278,7 @@ export interface RetrievalOptions {
291
278
  sessionId?: string | null;
292
279
  /** Restrict which scopes may match. Defaults to all three. */
293
280
  scopes?: GraphScope[];
294
- /** Restrict to one kind of memory. Defaults to both. */
295
- kinds?: GraphNodeKind[];
296
- /** Restrict to particular subkinds (decision, failure, entity, file, …). */
281
+ /** Restrict to particular subkinds (decision, failure, entity, …). */
297
282
  subkinds?: string[];
298
283
  /** Restrict by who wrote it: inferred, asked for by an agent, or hand-written. */
299
284
  sources?: GraphSource[];
@@ -306,9 +291,9 @@ export interface RetrievalOptions {
306
291
  * action turn it on, because that is where "we already solved this in the
307
292
  * other repo" has to arrive without being asked for.
308
293
  *
309
- * Structural nodes never travel whatever this says — another repository's
310
- * file paths are noise here, and admitting them is the leak the hard project
311
- * filter was originally added to stop.
294
+ * A memory only travels when it has been judged `anywhere`, which is what
295
+ * keeps one repository's local conventions out of another's results — the
296
+ * leak the hard project filter was originally added to stop.
312
297
  */
313
298
  crossProject?: boolean;
314
299
  /** Maximum hits returned after fusion. */
@@ -318,10 +303,10 @@ export interface RetrievalOptions {
318
303
  /** Include archived nodes. Defaults to false. */
319
304
  includeArchived?: boolean;
320
305
  /**
321
- * Repo-relative paths the session is currently working in. Their structural
322
- * nodes join the query's seeds, so a turn whose text carries no signal
323
- * ("continue", "fix it") still reaches the memories attached to the code in
324
- * front of it.
306
+ * Repo-relative paths the session is currently working in. The memories that
307
+ * claim something about them join the query's seeds, so a turn whose text
308
+ * carries no signal ("continue", "fix it") still reaches what is known about
309
+ * the code in front of it.
325
310
  */
326
311
  anchorPaths?: string[];
327
312
  /**
@@ -369,7 +354,6 @@ export interface RetrievalResult {
369
354
  /** A node as sent to the graph view: display fields plus its community. */
370
355
  export interface GraphViewNode {
371
356
  id: string;
372
- kind: GraphNodeKind;
373
357
  subkind: GraphNodeSubkind;
374
358
  scope: GraphScope;
375
359
  label: string;
@@ -534,10 +518,9 @@ export interface MemoryReadiness {
534
518
  }
535
519
 
536
520
  export interface GraphStats {
521
+ /** Live memories — every node in the graph is one. */
537
522
  nodes: number;
538
523
  edges: number;
539
- episodic: number;
540
- structural: number;
541
524
  vectors: number;
542
525
  byScope: Record<GraphScope, number>;
543
526
  byProject: { projectId: string | null; count: number }[];
@@ -545,7 +528,7 @@ export interface GraphStats {
545
528
  superseded: number;
546
529
  /** Memories whose code changed underneath them since they were written. */
547
530
  stale: number;
548
- /** Canonical entity nodes (people, tools, systems) everything else hangs off. */
531
+ /** Memories carrying a canonical entity key (a person, a tool, a system). */
549
532
  entities: number;
550
533
  /** Memories a later turn confirmed it actually used. */
551
534
  confirmedUseful: number;
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  export interface ButtonProps {
6
- variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
6
+ variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
7
7
  size?: 'sm' | 'md' | 'lg';
8
8
  disabled?: boolean;
9
9
  loading?: boolean;