rivet-design 0.5.4 → 0.5.7

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 (64) hide show
  1. package/README.md +18 -18
  2. package/README.npm.md +18 -18
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +51 -14
  5. package/dist/index.js.map +1 -1
  6. package/dist/mcp/server.d.ts.map +1 -1
  7. package/dist/mcp/server.js +2 -67
  8. package/dist/mcp/server.js.map +1 -1
  9. package/dist/services/TelemetryService.d.ts.map +1 -1
  10. package/dist/services/TelemetryService.js +5 -0
  11. package/dist/services/TelemetryService.js.map +1 -1
  12. package/package.json +3 -3
  13. package/src/ui/dist/assets/main-DAIpACRO.js +491 -0
  14. package/src/ui/dist/index.html +1 -1
  15. package/dist/routes/agent.d.ts +0 -8
  16. package/dist/routes/agent.d.ts.map +0 -1
  17. package/dist/routes/agent.js +0 -79
  18. package/dist/routes/agent.js.map +0 -1
  19. package/dist/routes/comments.d.ts +0 -2
  20. package/dist/routes/comments.d.ts.map +0 -1
  21. package/dist/routes/comments.js +0 -92
  22. package/dist/routes/comments.js.map +0 -1
  23. package/dist/routes/onboarding.d.ts +0 -6
  24. package/dist/routes/onboarding.d.ts.map +0 -1
  25. package/dist/routes/onboarding.js +0 -206
  26. package/dist/routes/onboarding.js.map +0 -1
  27. package/dist/routes/selection.d.ts +0 -2
  28. package/dist/routes/selection.d.ts.map +0 -1
  29. package/dist/routes/selection.js +0 -38
  30. package/dist/routes/selection.js.map +0 -1
  31. package/dist/scripts/react-instrumentation.js +0 -300
  32. package/dist/services/AgentBridgeService.d.ts +0 -89
  33. package/dist/services/AgentBridgeService.d.ts.map +0 -1
  34. package/dist/services/AgentBridgeService.js +0 -413
  35. package/dist/services/AgentBridgeService.js.map +0 -1
  36. package/dist/services/AgentModService.d.ts +0 -76
  37. package/dist/services/AgentModService.d.ts.map +0 -1
  38. package/dist/services/AgentModService.js +0 -494
  39. package/dist/services/AgentModService.js.map +0 -1
  40. package/dist/services/CommentSessionManager.d.ts +0 -94
  41. package/dist/services/CommentSessionManager.d.ts.map +0 -1
  42. package/dist/services/CommentSessionManager.js +0 -260
  43. package/dist/services/CommentSessionManager.js.map +0 -1
  44. package/dist/services/ImportResolverService.d.ts +0 -30
  45. package/dist/services/ImportResolverService.d.ts.map +0 -1
  46. package/dist/services/ImportResolverService.js +0 -136
  47. package/dist/services/ImportResolverService.js.map +0 -1
  48. package/dist/services/ReactComponentPlugin.d.ts +0 -44
  49. package/dist/services/ReactComponentPlugin.d.ts.map +0 -1
  50. package/dist/services/ReactComponentPlugin.js +0 -100
  51. package/dist/services/ReactComponentPlugin.js.map +0 -1
  52. package/dist/types/agent-protocol.d.ts +0 -55
  53. package/dist/types/agent-protocol.d.ts.map +0 -1
  54. package/dist/types/agent-protocol.js +0 -6
  55. package/dist/types/agent-protocol.js.map +0 -1
  56. package/dist/types/agent-tools.d.ts +0 -78
  57. package/dist/types/agent-tools.d.ts.map +0 -1
  58. package/dist/types/agent-tools.js +0 -7
  59. package/dist/types/agent-tools.js.map +0 -1
  60. package/dist/types/types.d.ts +0 -15
  61. package/dist/types/types.d.ts.map +0 -1
  62. package/dist/types/types.js +0 -3
  63. package/dist/types/types.js.map +0 -1
  64. package/src/ui/dist/assets/main-BXXN24hn.js +0 -505
@@ -1,300 +0,0 @@
1
- // React DevTools instrumentation for Rivet
2
- // Uses bippy library for reliable React Fiber tree access
3
- (function () {
4
- 'use strict';
5
-
6
- console.log('[Rivet] React instrumentation loaded');
7
-
8
- /**
9
- * Check if React is present on the page by looking for React fiber on any element
10
- */
11
- function detectReact() {
12
- // Check if any DOM element has React fiber attached
13
- const elements = document.querySelectorAll('*');
14
- for (let i = 0; i < elements.length; i++) {
15
- const element = elements[i];
16
- const hasFiber = Object.keys(element).some(
17
- (key) =>
18
- key.startsWith('__reactFiber$') ||
19
- key.startsWith('__reactInternalInstance$'),
20
- );
21
- if (hasFiber) {
22
- console.log('[Rivet] React detected on page');
23
- return true;
24
- }
25
- }
26
- return false;
27
- }
28
-
29
- /**
30
- * Load bippy library dynamically
31
- */
32
- let bippyLoading = null;
33
- async function loadBippy() {
34
- if (window.Bippy) {
35
- return window.Bippy;
36
- }
37
-
38
- // If already loading, wait for it
39
- if (bippyLoading) {
40
- return bippyLoading;
41
- }
42
-
43
- bippyLoading = new Promise((resolve, reject) => {
44
- try {
45
- // Load bippy from CDN (exposes window.Bippy)
46
- const script = document.createElement('script');
47
- script.src = 'https://unpkg.com/bippy';
48
-
49
- script.onload = () => {
50
- console.log('[Rivet] Bippy library loaded');
51
- resolve(window.Bippy);
52
- };
53
-
54
- script.onerror = () => {
55
- console.error('[Rivet] Failed to load bippy');
56
- reject(new Error('Failed to load bippy'));
57
- };
58
-
59
- document.head.appendChild(script);
60
- } catch (error) {
61
- console.error('[Rivet] Error loading bippy:', error);
62
- reject(error);
63
- }
64
- });
65
-
66
- return bippyLoading;
67
- }
68
-
69
- /**
70
- * Find the React Fiber node for a DOM element using bippy
71
- */
72
- async function getFiberFromElement(element) {
73
- if (!element) return null;
74
-
75
- try {
76
- const Bippy = await loadBippy();
77
-
78
- if (Bippy && Bippy.getNearestHostFiber) {
79
- const fiber = Bippy.getNearestHostFiber(element);
80
- if (fiber) {
81
- console.log('[Rivet] Got fiber from bippy');
82
- return fiber;
83
- }
84
- }
85
- } catch (error) {
86
- console.warn('[Rivet] Error using bippy, falling back to manual:', error);
87
- }
88
-
89
- // Fallback to manual method
90
- console.log('[Rivet] Using manual fiber extraction');
91
- const fiberKey = Object.keys(element).find(
92
- (key) =>
93
- key.startsWith('__reactFiber$') ||
94
- key.startsWith('__reactInternalInstance$') ||
95
- key.startsWith('__reactProps$'),
96
- );
97
-
98
- if (fiberKey && fiberKey.startsWith('__reactFiber')) {
99
- return element[fiberKey];
100
- }
101
-
102
- if (fiberKey && fiberKey.startsWith('__reactProps')) {
103
- const fiberId = fiberKey.replace('__reactProps$', '__reactFiber$');
104
- if (element[fiberId]) {
105
- return element[fiberId];
106
- }
107
- }
108
-
109
- return null;
110
- }
111
-
112
- /**
113
- * Walk up the Fiber tree to collect ALL parent components with source locations
114
- */
115
- async function findAllComponentsInTree(fiber) {
116
- if (!fiber) return [];
117
-
118
- const components = [];
119
- let current = fiber;
120
- const seenFiles = new Set(); // Avoid duplicates
121
- let nodeCount = 0;
122
- let debugInfo = { nodesChecked: 0, nodesWithSource: 0, nodesWithType: 0 };
123
-
124
- console.log('[Rivet] Walking React Fiber tree...');
125
-
126
- // Try to load bippy for better component names
127
- let Bippy = null;
128
- try {
129
- Bippy = await loadBippy();
130
- } catch (e) {
131
- console.log('[Rivet] Bippy not available, using manual names');
132
- }
133
-
134
- while (current && nodeCount < 50) {
135
- // Limit to prevent infinite loops
136
- nodeCount++;
137
- debugInfo.nodesChecked++;
138
-
139
- // Log fiber node properties for debugging
140
- if (nodeCount <= 5) {
141
- console.log(`[Rivet] Fiber node ${nodeCount}:`, {
142
- type:
143
- current.type?.name ||
144
- current.type?.displayName ||
145
- typeof current.type,
146
- tag: current.tag,
147
- hasDebugSource: !!current._debugSource,
148
- hasDebugOwner: !!current._debugOwner,
149
- debugSourceFile: current._debugSource?.fileName,
150
- debugOwnerSourceFile: current._debugOwner?._debugSource?.fileName,
151
- });
152
- }
153
-
154
- // Check if this fiber has debug source (component source location)
155
- const source = current._debugSource || current._debugOwner?._debugSource;
156
-
157
- if (source && source.fileName) {
158
- debugInfo.nodesWithSource++;
159
-
160
- // Get component name - try bippy first for better names
161
- let componentName = null;
162
- if (Bippy && Bippy.getDisplayName) {
163
- try {
164
- componentName = Bippy.getDisplayName(current);
165
- } catch (e) {
166
- // Bippy failed, fall through to manual
167
- }
168
- }
169
-
170
- // Fallback to manual name extraction
171
- if (!componentName) {
172
- if (current.type) {
173
- debugInfo.nodesWithType++;
174
- componentName = current.type.name || current.type.displayName;
175
- } else if (current._debugOwner?.type) {
176
- componentName =
177
- current._debugOwner.type.name ||
178
- current._debugOwner.type.displayName;
179
- }
180
- }
181
-
182
- // Only add if we haven't seen this file yet
183
- const fileKey = `${source.fileName}:${source.lineNumber}`;
184
- if (!seenFiles.has(fileKey)) {
185
- seenFiles.add(fileKey);
186
- components.push({
187
- filePath: source.fileName,
188
- line: source.lineNumber,
189
- column: source.columnNumber,
190
- componentName: componentName || 'Unknown',
191
- });
192
- console.log(
193
- `[Rivet] Found component: ${componentName || 'Unknown'} at ${source.fileName}:${source.lineNumber}`,
194
- );
195
- }
196
- }
197
-
198
- // Move up the tree (return fiber -> parent fiber)
199
- current = current.return;
200
- }
201
-
202
- console.log('[Rivet] Fiber tree walk complete:', debugInfo);
203
-
204
- return components;
205
- }
206
-
207
- /**
208
- * Extract component information from a DOM element
209
- * Returns ALL parent components in the tree hierarchy
210
- */
211
- async function getComponentInfo(element) {
212
- if (!element || !(element instanceof HTMLElement)) {
213
- return null;
214
- }
215
-
216
- try {
217
- // Find the fiber node for this element (async with bippy)
218
- const fiber = await getFiberFromElement(element);
219
- if (!fiber) {
220
- console.warn('[Rivet] No fiber found for element:', element);
221
- return null;
222
- }
223
-
224
- // Find ALL components in the fiber tree (async with bippy)
225
- const components = await findAllComponentsInTree(fiber);
226
- if (components.length === 0) {
227
- console.warn('[Rivet] No component source found for element:', element);
228
- return null;
229
- }
230
-
231
- // Clean file paths for all components
232
- const cleanedComponents = components.map((comp) => {
233
- let filePath = comp.filePath;
234
-
235
- // Remove webpack prefixes like "webpack://" or "webpack-internal:///"
236
- filePath = filePath.replace(/^webpack(-internal)?:\/\/\//, '');
237
- filePath = filePath.replace(/^\.\//, '');
238
-
239
- // For Create React App and similar, remove the leading dot-slash
240
- if (filePath.startsWith('./')) {
241
- filePath = filePath.substring(2);
242
- }
243
-
244
- return {
245
- filePath,
246
- line: comp.line,
247
- column: comp.column,
248
- componentName: comp.componentName,
249
- };
250
- });
251
-
252
- console.log(
253
- `[Rivet] Found ${cleanedComponents.length} components in tree:`,
254
- cleanedComponents,
255
- );
256
-
257
- // Return the component hierarchy
258
- return {
259
- components: cleanedComponents,
260
- // Primary component is the first (closest to selected element)
261
- primaryComponent: cleanedComponents[0],
262
- };
263
- } catch (error) {
264
- console.error('[Rivet] Error extracting component info:', error);
265
- return null;
266
- }
267
- }
268
-
269
- /**
270
- * Check if React is available
271
- */
272
- function isReactAvailable() {
273
- return detectReact();
274
- }
275
-
276
- // Try to detect React on page load
277
- if (document.readyState === 'loading') {
278
- document.addEventListener('DOMContentLoaded', () => {
279
- if (detectReact()) {
280
- console.log('[Rivet] React instrumentation ready');
281
- }
282
- });
283
- } else {
284
- // Page already loaded, check now
285
- if (detectReact()) {
286
- console.log('[Rivet] React instrumentation ready');
287
- }
288
- }
289
-
290
- // Expose API on window
291
- window.__RIVET_REACT__ = {
292
- getComponentInfo,
293
- isReactAvailable,
294
- version: '1.0.0',
295
- };
296
-
297
- console.log(
298
- '[Rivet] React instrumentation API exposed on window.__RIVET_REACT__',
299
- );
300
- })();
@@ -1,89 +0,0 @@
1
- import { SessionService } from './SessionService';
2
- import type { Response } from 'express';
3
- /**
4
- * Connects Rivet CLI to hosted Agent SDK server
5
- * Executes tools locally and sends results back via WebSocket
6
- */
7
- export declare class AgentBridgeService {
8
- private serverUrl;
9
- private ws;
10
- private componentSearch;
11
- private fileModService;
12
- private gitService;
13
- private sessionService;
14
- private projectPath;
15
- private isConnected;
16
- private sseClients;
17
- private heartbeatInterval;
18
- private reconnectTimeout;
19
- private configManager;
20
- private proxyUrl;
21
- private authToken;
22
- constructor(serverUrl: string, authToken: string, projectPath: string, sessionService: SessionService | null);
23
- /**
24
- * Refresh access token using refresh token
25
- */
26
- private refreshAccessToken;
27
- /**
28
- * Connect to hosted Agent SDK server
29
- */
30
- connect(retryCount?: number): Promise<void>;
31
- /**
32
- * Handle messages from server
33
- */
34
- private handleMessage;
35
- /**
36
- * Execute tool locally using Rivet's services
37
- */
38
- private executeToolLocally;
39
- /**
40
- * Tool implementations
41
- */
42
- private executeSearchComponents;
43
- private executeReadFile;
44
- private executeWriteFile;
45
- private executeGlobFiles;
46
- private executeGitStatus;
47
- private executeGitDiff;
48
- /**
49
- * Execute instruction via Agent SDK
50
- */
51
- executeTask(instruction: string, context?: any): Promise<void>;
52
- /**
53
- * Register SSE client for streaming updates
54
- */
55
- registerSSEClient(res: Response): void;
56
- /**
57
- * Broadcast event to all SSE clients
58
- */
59
- private broadcastToSSE;
60
- /**
61
- * Send SSE message to specific client
62
- */
63
- private sendSSE;
64
- /**
65
- * Send message to server
66
- */
67
- private send;
68
- /**
69
- * Start heartbeat ping/pong
70
- */
71
- private startHeartbeat;
72
- /**
73
- * Stop heartbeat
74
- */
75
- private stopHeartbeat;
76
- /**
77
- * Schedule reconnection attempt
78
- */
79
- private scheduleReconnect;
80
- /**
81
- * Check if connected to server
82
- */
83
- getIsConnected(): boolean;
84
- /**
85
- * Cleanup resources
86
- */
87
- cleanup(): void;
88
- }
89
- //# sourceMappingURL=AgentBridgeService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentBridgeService.d.ts","sourceRoot":"","sources":["../../src/services/AgentBridgeService.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAuBxC;;;GAGG;AACH,qBAAa,kBAAkB;IAgB3B,OAAO,CAAC,SAAS;IAfnB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,iBAAiB,CAA+C;IACxE,OAAO,CAAC,gBAAgB,CAA8C;IACtE,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;gBAGhB,SAAS,EAAE,MAAM,EACzB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,cAAc,GAAG,IAAI;IAWvC;;OAEG;YACW,kBAAkB;IAuChC;;OAEG;IACG,OAAO,CAAC,UAAU,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAwFpD;;OAEG;YACW,aAAa;IA6B3B;;OAEG;YACW,kBAAkB;IAgEhC;;OAEG;YAEW,uBAAuB;YAWvB,eAAe;YAWf,gBAAgB;YAehB,gBAAgB;YAWhB,gBAAgB;YAehB,cAAc;IAkB5B;;OAEG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAYpE;;OAEG;IACH,iBAAiB,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAkBtC;;OAEG;IACH,OAAO,CAAC,cAAc;IAQtB;;OAEG;IACH,OAAO,CAAC,OAAO;IAUf;;OAEG;IACH,OAAO,CAAC,IAAI;IASZ;;OAEG;IACH,OAAO,CAAC,cAAc;IAYtB;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoBzB;;OAEG;IACH,cAAc,IAAI,OAAO;IAIzB;;OAEG;IACH,OAAO,IAAI,IAAI;CAyBhB"}