rivet-design 0.9.10 → 0.10.1
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/dist/config/flags.d.ts +3 -0
- package/dist/config/flags.d.ts.map +1 -1
- package/dist/config/flags.js +1 -0
- package/dist/config/flags.js.map +1 -1
- package/dist/config/proxy.d.ts +1 -0
- package/dist/config/proxy.d.ts.map +1 -1
- package/dist/config/proxy.js +9 -1
- package/dist/config/proxy.js.map +1 -1
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +249 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts +5 -0
- package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
- package/dist/mcp/agent-variants/WorktreeOrchestrator.js +7 -0
- package/dist/mcp/agent-variants/WorktreeOrchestrator.js.map +1 -1
- package/dist/mcp/server.d.ts +19 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +67 -102
- package/dist/mcp/server.js.map +1 -1
- package/dist/prototype-host.d.ts +2 -0
- package/dist/prototype-host.d.ts.map +1 -0
- package/dist/prototype-host.js +56 -0
- package/dist/prototype-host.js.map +1 -0
- package/dist/proxy-middleware/preview-bridge.d.ts +24 -0
- package/dist/proxy-middleware/preview-bridge.d.ts.map +1 -0
- package/dist/proxy-middleware/preview-bridge.js +358 -0
- package/dist/proxy-middleware/preview-bridge.js.map +1 -0
- package/dist/proxy-middleware/proxy-config.d.ts +5 -1
- package/dist/proxy-middleware/proxy-config.d.ts.map +1 -1
- package/dist/proxy-middleware/proxy-config.js +62 -18
- package/dist/proxy-middleware/proxy-config.js.map +1 -1
- package/dist/routes/agentVariants.d.ts +2 -1
- package/dist/routes/agentVariants.d.ts.map +1 -1
- package/dist/routes/agentVariants.js +104 -1
- package/dist/routes/agentVariants.js.map +1 -1
- package/dist/routes/mcp.d.ts +3 -1
- package/dist/routes/mcp.d.ts.map +1 -1
- package/dist/routes/mcp.js +33 -3
- package/dist/routes/mcp.js.map +1 -1
- package/dist/routes/prototypeHost.d.ts +13 -0
- package/dist/routes/prototypeHost.d.ts.map +1 -0
- package/dist/routes/prototypeHost.js +207 -0
- package/dist/routes/prototypeHost.js.map +1 -0
- package/dist/routes/static.d.ts +6 -1
- package/dist/routes/static.d.ts.map +1 -1
- package/dist/routes/static.js +15 -3
- package/dist/routes/static.js.map +1 -1
- package/dist/server.d.ts +48 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +228 -33
- package/dist/server.js.map +1 -1
- package/dist/services/AgentSessionService.d.ts +87 -0
- package/dist/services/AgentSessionService.d.ts.map +1 -0
- package/dist/services/AgentSessionService.js +275 -0
- package/dist/services/AgentSessionService.js.map +1 -0
- package/dist/services/BundleStore.d.ts +36 -0
- package/dist/services/BundleStore.d.ts.map +1 -0
- package/dist/services/BundleStore.js +102 -0
- package/dist/services/BundleStore.js.map +1 -0
- package/dist/services/ConfigManager.d.ts +7 -0
- package/dist/services/ConfigManager.d.ts.map +1 -1
- package/dist/services/ConfigManager.js +13 -0
- package/dist/services/ConfigManager.js.map +1 -1
- package/dist/services/HostedDemoAuthSessionService.d.ts +6 -0
- package/dist/services/HostedDemoAuthSessionService.d.ts.map +1 -1
- package/dist/services/HostedDemoAuthSessionService.js +13 -0
- package/dist/services/HostedDemoAuthSessionService.js.map +1 -1
- package/dist/services/InlineVariantGenerationService.d.ts +50 -0
- package/dist/services/InlineVariantGenerationService.d.ts.map +1 -0
- package/dist/services/InlineVariantGenerationService.js +394 -0
- package/dist/services/InlineVariantGenerationService.js.map +1 -0
- package/dist/services/PrototypeBuildService.d.ts +38 -0
- package/dist/services/PrototypeBuildService.d.ts.map +1 -0
- package/dist/services/PrototypeBuildService.js +165 -0
- package/dist/services/PrototypeBuildService.js.map +1 -0
- package/dist/services/PrototypeDeployService.d.ts +34 -0
- package/dist/services/PrototypeDeployService.d.ts.map +1 -0
- package/dist/services/PrototypeDeployService.js +115 -0
- package/dist/services/PrototypeDeployService.js.map +1 -0
- package/dist/services/SessionBridgeService.d.ts +3 -3
- package/dist/services/SessionBridgeService.d.ts.map +1 -1
- package/dist/services/SessionBridgeService.js +15 -3
- package/dist/services/SessionBridgeService.js.map +1 -1
- package/dist/services/SupabaseAuthService.d.ts +25 -0
- package/dist/services/SupabaseAuthService.d.ts.map +1 -0
- package/dist/services/SupabaseAuthService.js +56 -0
- package/dist/services/SupabaseAuthService.js.map +1 -0
- package/dist/services/TerminalAgentRunner.d.ts +65 -0
- package/dist/services/TerminalAgentRunner.d.ts.map +1 -0
- package/dist/services/TerminalAgentRunner.js +511 -0
- package/dist/services/TerminalAgentRunner.js.map +1 -0
- package/dist/services/VariantHistoryService.d.ts +23 -0
- package/dist/services/VariantHistoryService.d.ts.map +1 -1
- package/dist/services/VariantHistoryService.js +22 -0
- package/dist/services/VariantHistoryService.js.map +1 -1
- package/dist/services/WorktreeManager.d.ts +5 -4
- package/dist/services/WorktreeManager.d.ts.map +1 -1
- package/dist/services/WorktreeManager.js +22 -12
- package/dist/services/WorktreeManager.js.map +1 -1
- package/dist/services/accessTokenRefresh.d.ts +8 -0
- package/dist/services/accessTokenRefresh.d.ts.map +1 -1
- package/dist/services/accessTokenRefresh.js +30 -1
- package/dist/services/accessTokenRefresh.js.map +1 -1
- package/dist/services/createAgentVariantsOrchestrator.d.ts +16 -0
- package/dist/services/createAgentVariantsOrchestrator.d.ts.map +1 -0
- package/dist/services/createAgentVariantsOrchestrator.js +42 -0
- package/dist/services/createAgentVariantsOrchestrator.js.map +1 -0
- package/dist/types/change-request-types.d.ts +12 -0
- package/dist/types/change-request-types.d.ts.map +1 -1
- package/dist/utils/elementFileHintSignals.d.ts +8 -0
- package/dist/utils/elementFileHintSignals.d.ts.map +1 -0
- package/dist/utils/elementFileHintSignals.js +40 -0
- package/dist/utils/elementFileHintSignals.js.map +1 -0
- package/dist/utils/formatElementTargetingContext.d.ts +34 -0
- package/dist/utils/formatElementTargetingContext.d.ts.map +1 -0
- package/dist/utils/formatElementTargetingContext.js +88 -0
- package/dist/utils/formatElementTargetingContext.js.map +1 -0
- package/dist/utils/queueAccess.d.ts +11 -0
- package/dist/utils/queueAccess.d.ts.map +1 -0
- package/dist/utils/queueAccess.js +15 -0
- package/dist/utils/queueAccess.js.map +1 -0
- package/package.json +3 -2
- package/src/ui/dist/assets/main-CJ9ZAQrU.css +1 -0
- package/src/ui/dist/assets/main-D-FdZGgx.js +640 -0
- package/src/ui/dist/index.html +2 -2
- package/src/ui/dist/assets/main-BZEruoyc.css +0 -1
- package/src/ui/dist/assets/main-ChnGmvJG.js +0 -382
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isHtmlDocumentRequest = exports.injectPreviewBridge = exports.shouldInjectPreviewBridge = exports.allowPreviewBridgeNonceInCsp = exports.createPreviewBridgeScript = exports.PREVIEW_BRIDGE_CHANNEL = exports.PREVIEW_BRIDGE_SCRIPT_ID = void 0;
|
|
4
|
+
exports.PREVIEW_BRIDGE_SCRIPT_ID = 'rivet-preview-bridge';
|
|
5
|
+
exports.PREVIEW_BRIDGE_CHANNEL = 'rivet-preview-bridge';
|
|
6
|
+
const MAX_SIBLING_CONTEXT_COUNT = 6;
|
|
7
|
+
const TEXT_SNIPPET_MAX_LENGTH = 80;
|
|
8
|
+
const buildBridgeScript = ({ expectedParentOrigin, } = {}) => `
|
|
9
|
+
(() => {
|
|
10
|
+
const CHANNEL = '${exports.PREVIEW_BRIDGE_CHANNEL}';
|
|
11
|
+
const EXPECTED_PARENT_ORIGIN = ${JSON.stringify(expectedParentOrigin ?? null)} || window.location.origin;
|
|
12
|
+
const RIVET_ID_ATTR = 'data-rivet-id';
|
|
13
|
+
const MAX_SIBLING_CONTEXT_COUNT = ${MAX_SIBLING_CONTEXT_COUNT};
|
|
14
|
+
const TEXT_SNIPPET_MAX_LENGTH = ${TEXT_SNIPPET_MAX_LENGTH};
|
|
15
|
+
if (window.__RIVET_PREVIEW_BRIDGE_ACTIVE__) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
window.__RIVET_PREVIEW_BRIDGE_ACTIVE__ = true;
|
|
19
|
+
|
|
20
|
+
const getClassName = (element) => {
|
|
21
|
+
try {
|
|
22
|
+
const value = element.className;
|
|
23
|
+
if (typeof value === 'string') {
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
if (value && typeof value === 'object' && 'baseVal' in value) {
|
|
27
|
+
return value.baseVal || '';
|
|
28
|
+
}
|
|
29
|
+
} catch {}
|
|
30
|
+
return '';
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const getTextSnippet = (element) => {
|
|
34
|
+
const text = (element.textContent || '').replace(/\\s+/g, ' ').trim();
|
|
35
|
+
return text.slice(0, TEXT_SNIPPET_MAX_LENGTH);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const getXPath = (element) => {
|
|
39
|
+
if (element.id) {
|
|
40
|
+
return '//*[@id="' + element.id + '"]';
|
|
41
|
+
}
|
|
42
|
+
if (element === document.body) {
|
|
43
|
+
return '/html/body';
|
|
44
|
+
}
|
|
45
|
+
let index = 0;
|
|
46
|
+
const siblings = element.parentNode ? element.parentNode.childNodes : [];
|
|
47
|
+
for (let i = 0; i < siblings.length; i += 1) {
|
|
48
|
+
const sibling = siblings[i];
|
|
49
|
+
if (sibling === element) {
|
|
50
|
+
const parent = element.parentNode;
|
|
51
|
+
return parent
|
|
52
|
+
? getXPath(parent) + '/' + element.tagName.toLowerCase() + '[' + (index + 1) + ']'
|
|
53
|
+
: '';
|
|
54
|
+
}
|
|
55
|
+
if (sibling.nodeType === 1 && sibling.tagName === element.tagName) {
|
|
56
|
+
index += 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return '';
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const getElementByXPath = (xpath) => {
|
|
63
|
+
try {
|
|
64
|
+
const result = document.evaluate(
|
|
65
|
+
xpath,
|
|
66
|
+
document,
|
|
67
|
+
null,
|
|
68
|
+
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
|
69
|
+
null,
|
|
70
|
+
);
|
|
71
|
+
return result.singleNodeValue || null;
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const ensureRivetId = (element) => {
|
|
78
|
+
const existing = element.getAttribute(RIVET_ID_ATTR);
|
|
79
|
+
if (existing && existing.trim()) {
|
|
80
|
+
return existing.trim();
|
|
81
|
+
}
|
|
82
|
+
const id =
|
|
83
|
+
globalThis.crypto && typeof globalThis.crypto.randomUUID === 'function'
|
|
84
|
+
? globalThis.crypto.randomUUID()
|
|
85
|
+
: 'rivet-' + Math.random().toString(36).slice(2, 11);
|
|
86
|
+
element.setAttribute(RIVET_ID_ATTR, id);
|
|
87
|
+
return id;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const transformStyles = (styles) => {
|
|
91
|
+
const result = {};
|
|
92
|
+
for (let i = 0; i < styles.length; i += 1) {
|
|
93
|
+
const prop = styles[i];
|
|
94
|
+
result[prop] = styles.getPropertyValue(prop);
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const getSiblingElements = (element) => {
|
|
100
|
+
const parent = element.parentElement;
|
|
101
|
+
if (!parent) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
const siblings = Array.from(parent.children);
|
|
105
|
+
const currentIndex = siblings.indexOf(element);
|
|
106
|
+
if (currentIndex === -1) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
const result = siblings
|
|
110
|
+
.map((sibling, index) => ({ sibling, index }))
|
|
111
|
+
.filter(({ sibling }) => sibling !== element)
|
|
112
|
+
.sort((a, b) => Math.abs(a.index - currentIndex) - Math.abs(b.index - currentIndex))
|
|
113
|
+
.slice(0, MAX_SIBLING_CONTEXT_COUNT)
|
|
114
|
+
.map(({ sibling, index }) => ({
|
|
115
|
+
tagName: sibling.tagName.toLowerCase(),
|
|
116
|
+
className: getClassName(sibling),
|
|
117
|
+
id: sibling.id || '',
|
|
118
|
+
textSnippet: getTextSnippet(sibling),
|
|
119
|
+
relativePosition: index < currentIndex ? 'previous' : 'next',
|
|
120
|
+
}));
|
|
121
|
+
return result.length > 0 ? result : undefined;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const getParentSummary = (element) => {
|
|
125
|
+
const parent = element.parentElement;
|
|
126
|
+
if (!parent) {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
tagName: parent.tagName.toLowerCase(),
|
|
131
|
+
className: getClassName(parent),
|
|
132
|
+
id: parent.id || '',
|
|
133
|
+
textSnippet: getTextSnippet(parent),
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const extractElement = (element) => {
|
|
138
|
+
if (!element) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const rect = element.getBoundingClientRect();
|
|
142
|
+
const computedStyles = window.getComputedStyle(element);
|
|
143
|
+
const attributes = {};
|
|
144
|
+
for (const attr of Array.from(element.attributes || [])) {
|
|
145
|
+
attributes[attr.name] = attr.value;
|
|
146
|
+
}
|
|
147
|
+
const rivetId = ensureRivetId(element);
|
|
148
|
+
return {
|
|
149
|
+
tagName: element.tagName.toLowerCase(),
|
|
150
|
+
className: getClassName(element),
|
|
151
|
+
id: element.id || '',
|
|
152
|
+
textContent: (element.textContent || '').trim().slice(0, 100),
|
|
153
|
+
innerHTML: (element.innerHTML || '').slice(0, 200),
|
|
154
|
+
attributes,
|
|
155
|
+
computedStyles: transformStyles(computedStyles),
|
|
156
|
+
boundingRect: {
|
|
157
|
+
x: rect.x,
|
|
158
|
+
y: rect.y,
|
|
159
|
+
width: rect.width,
|
|
160
|
+
height: rect.height,
|
|
161
|
+
top: rect.top,
|
|
162
|
+
left: rect.left,
|
|
163
|
+
right: rect.right,
|
|
164
|
+
bottom: rect.bottom,
|
|
165
|
+
},
|
|
166
|
+
xpath: getXPath(element),
|
|
167
|
+
rivetId,
|
|
168
|
+
siblingElements: getSiblingElements(element),
|
|
169
|
+
parentElementSummary: getParentSummary(element),
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const elementFromIdentifier = (identifier) => {
|
|
174
|
+
if (!identifier || typeof identifier !== 'object') {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
const rivetId = typeof identifier.rivetId === 'string' ? identifier.rivetId.trim() : '';
|
|
178
|
+
if (rivetId) {
|
|
179
|
+
try {
|
|
180
|
+
const element = document.querySelector('[' + RIVET_ID_ATTR + '="' + CSS.escape(rivetId) + '"]');
|
|
181
|
+
if (element) {
|
|
182
|
+
return element;
|
|
183
|
+
}
|
|
184
|
+
} catch {}
|
|
185
|
+
}
|
|
186
|
+
const xpath = typeof identifier.xpath === 'string' ? identifier.xpath : '';
|
|
187
|
+
return xpath ? getElementByXPath(xpath) : null;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const elementsInBox = (box) => {
|
|
191
|
+
const candidates = new Set();
|
|
192
|
+
const step = 32;
|
|
193
|
+
const xCount = Math.max(2, Math.min(24, Math.ceil((box.right - box.left) / step) + 1));
|
|
194
|
+
const yCount = Math.max(2, Math.min(24, Math.ceil((box.bottom - box.top) / step) + 1));
|
|
195
|
+
for (let xi = 0; xi < xCount; xi += 1) {
|
|
196
|
+
const x = box.left + ((box.right - box.left) * xi) / (xCount - 1);
|
|
197
|
+
for (let yi = 0; yi < yCount; yi += 1) {
|
|
198
|
+
const y = box.top + ((box.bottom - box.top) * yi) / (yCount - 1);
|
|
199
|
+
const elements =
|
|
200
|
+
typeof document.elementsFromPoint === 'function'
|
|
201
|
+
? document.elementsFromPoint(x, y)
|
|
202
|
+
: [document.elementFromPoint(x, y)].filter(Boolean);
|
|
203
|
+
for (const element of elements) {
|
|
204
|
+
let current = element;
|
|
205
|
+
while (current) {
|
|
206
|
+
candidates.add(current);
|
|
207
|
+
current = current.parentElement;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return Array.from(candidates)
|
|
213
|
+
.filter((element) => {
|
|
214
|
+
const rect = element.getBoundingClientRect();
|
|
215
|
+
return (
|
|
216
|
+
rect.left < box.right &&
|
|
217
|
+
rect.right > box.left &&
|
|
218
|
+
rect.top < box.bottom &&
|
|
219
|
+
rect.bottom > box.top &&
|
|
220
|
+
rect.width > 0 &&
|
|
221
|
+
rect.height > 0
|
|
222
|
+
);
|
|
223
|
+
})
|
|
224
|
+
.map(extractElement)
|
|
225
|
+
.filter(Boolean);
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const send = (source, id, responseNonce, payload) => {
|
|
229
|
+
source.postMessage(
|
|
230
|
+
{
|
|
231
|
+
channel: CHANNEL,
|
|
232
|
+
direction: 'response',
|
|
233
|
+
id,
|
|
234
|
+
responseNonce,
|
|
235
|
+
...payload,
|
|
236
|
+
},
|
|
237
|
+
EXPECTED_PARENT_ORIGIN,
|
|
238
|
+
);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
window.addEventListener('message', (event) => {
|
|
242
|
+
const message = event.data;
|
|
243
|
+
if (!message || message.channel !== CHANNEL || message.direction !== 'request') {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (event.origin !== EXPECTED_PARENT_ORIGIN) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
event.stopImmediatePropagation();
|
|
250
|
+
const source = event.source;
|
|
251
|
+
if (!source || typeof source.postMessage !== 'function') {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
255
|
+
let result = null;
|
|
256
|
+
if (message.action === 'elementAtPoint') {
|
|
257
|
+
result = extractElement(document.elementFromPoint(message.payload.x, message.payload.y));
|
|
258
|
+
} else if (message.action === 'elementsInBox') {
|
|
259
|
+
result = elementsInBox(message.payload);
|
|
260
|
+
} else if (message.action === 'resolveElement') {
|
|
261
|
+
result = extractElement(elementFromIdentifier(message.payload));
|
|
262
|
+
} else if (message.action === 'setCursor') {
|
|
263
|
+
const cursor = typeof message.payload.cursor === 'string' ? message.payload.cursor : '';
|
|
264
|
+
document.documentElement.style.cursor = cursor;
|
|
265
|
+
document.body.style.cursor = cursor;
|
|
266
|
+
result = true;
|
|
267
|
+
} else if (message.action === 'scrollBy') {
|
|
268
|
+
window.scrollBy(message.payload.deltaX || 0, message.payload.deltaY || 0);
|
|
269
|
+
result = true;
|
|
270
|
+
} else {
|
|
271
|
+
throw new Error('Unknown action');
|
|
272
|
+
}
|
|
273
|
+
send(source, message.id, message.responseNonce, { ok: true, result });
|
|
274
|
+
} catch (error) {
|
|
275
|
+
send(source, message.id, message.responseNonce, {
|
|
276
|
+
ok: false,
|
|
277
|
+
error: error instanceof Error ? error.message : String(error),
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
})();
|
|
282
|
+
`.trim();
|
|
283
|
+
const createPreviewBridgeScript = (options = {}) => {
|
|
284
|
+
const nonceAttribute = options.scriptNonce
|
|
285
|
+
? ` nonce="${options.scriptNonce}"`
|
|
286
|
+
: '';
|
|
287
|
+
return `<script id="${exports.PREVIEW_BRIDGE_SCRIPT_ID}"${nonceAttribute}>${buildBridgeScript(options)}</script>`;
|
|
288
|
+
};
|
|
289
|
+
exports.createPreviewBridgeScript = createPreviewBridgeScript;
|
|
290
|
+
const SCRIPT_DIRECTIVES = new Set(['script-src', 'script-src-elem']);
|
|
291
|
+
const splitCspDirective = (directive) => directive
|
|
292
|
+
.trim()
|
|
293
|
+
.split(/\s+/)
|
|
294
|
+
.filter((part) => part.length > 0);
|
|
295
|
+
const allowPreviewBridgeNonceInCsp = (csp, { scriptNonce }) => {
|
|
296
|
+
const nonceSource = `'nonce-${scriptNonce}'`;
|
|
297
|
+
const directives = csp
|
|
298
|
+
.split(';')
|
|
299
|
+
.map((directive) => directive.trim())
|
|
300
|
+
.filter((directive) => directive.length > 0);
|
|
301
|
+
let hasScriptDirective = false;
|
|
302
|
+
const nextDirectives = directives.map((directive) => {
|
|
303
|
+
const parts = splitCspDirective(directive);
|
|
304
|
+
const name = parts[0]?.toLowerCase();
|
|
305
|
+
if (!SCRIPT_DIRECTIVES.has(name)) {
|
|
306
|
+
return directive;
|
|
307
|
+
}
|
|
308
|
+
hasScriptDirective = true;
|
|
309
|
+
return parts.includes(nonceSource)
|
|
310
|
+
? directive
|
|
311
|
+
: [...parts, nonceSource].join(' ');
|
|
312
|
+
});
|
|
313
|
+
if (!hasScriptDirective) {
|
|
314
|
+
const defaultDirective = directives.find((directive) => splitCspDirective(directive)[0]?.toLowerCase() === 'default-src');
|
|
315
|
+
const defaultSources = defaultDirective
|
|
316
|
+
? splitCspDirective(defaultDirective).slice(1)
|
|
317
|
+
: [];
|
|
318
|
+
nextDirectives.push(['script-src', ...defaultSources, nonceSource].join(' '));
|
|
319
|
+
}
|
|
320
|
+
return nextDirectives.join('; ');
|
|
321
|
+
};
|
|
322
|
+
exports.allowPreviewBridgeNonceInCsp = allowPreviewBridgeNonceInCsp;
|
|
323
|
+
const firstHeaderValue = (value) => Array.isArray(value) ? (value[0] ?? '') : (value ?? '');
|
|
324
|
+
/** Decides whether a proxied response should receive the isolated-preview bridge. */
|
|
325
|
+
const shouldInjectPreviewBridge = ({ method, accept, contentType, }) => {
|
|
326
|
+
if (method != null && method !== 'GET') {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
const normalizedAccept = firstHeaderValue(accept).toLowerCase();
|
|
330
|
+
const normalizedContentType = firstHeaderValue(contentType).toLowerCase();
|
|
331
|
+
return (normalizedAccept.includes('text/html') &&
|
|
332
|
+
normalizedContentType.includes('text/html'));
|
|
333
|
+
};
|
|
334
|
+
exports.shouldInjectPreviewBridge = shouldInjectPreviewBridge;
|
|
335
|
+
/** Adds the isolated-preview bridge to a proxied HTML document. */
|
|
336
|
+
const injectPreviewBridge = (html, options = {}) => {
|
|
337
|
+
if (html.includes(`id="${exports.PREVIEW_BRIDGE_SCRIPT_ID}"`)) {
|
|
338
|
+
return html;
|
|
339
|
+
}
|
|
340
|
+
const script = (0, exports.createPreviewBridgeScript)(options);
|
|
341
|
+
const headMatch = html.match(/<head[^>]*>/i);
|
|
342
|
+
if (headMatch?.index !== undefined) {
|
|
343
|
+
const insertAt = headMatch.index + headMatch[0].length;
|
|
344
|
+
return `${html.slice(0, insertAt)}${script}${html.slice(insertAt)}`;
|
|
345
|
+
}
|
|
346
|
+
if (html.includes('</head>')) {
|
|
347
|
+
return html.replace('</head>', `${script}</head>`);
|
|
348
|
+
}
|
|
349
|
+
if (html.includes('</body>')) {
|
|
350
|
+
return html.replace('</body>', `${script}</body>`);
|
|
351
|
+
}
|
|
352
|
+
return `${script}${html}`;
|
|
353
|
+
};
|
|
354
|
+
exports.injectPreviewBridge = injectPreviewBridge;
|
|
355
|
+
const isHtmlDocumentRequest = (req) => req.method === 'GET' &&
|
|
356
|
+
firstHeaderValue(req.headers.accept).toLowerCase().includes('text/html');
|
|
357
|
+
exports.isHtmlDocumentRequest = isHtmlDocumentRequest;
|
|
358
|
+
//# sourceMappingURL=preview-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-bridge.js","sourceRoot":"","sources":["../../src/proxy-middleware/preview-bridge.ts"],"names":[],"mappings":";;;AAEa,QAAA,wBAAwB,GAAG,sBAAsB,CAAC;AAClD,QAAA,sBAAsB,GAAG,sBAAsB,CAAC;AAa7D,MAAM,yBAAyB,GAAG,CAAC,CAAC;AACpC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,MAAM,iBAAiB,GAAG,CAAC,EACzB,oBAAoB,MACa,EAAE,EAAE,EAAE,CAAC;;qBAErB,8BAAsB;mCACR,IAAI,CAAC,SAAS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AC,CAAC,MAAM,CAAC;QACvD,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;IACtE,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,MAAM,SAAS,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,MAAM,SAAS,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC;AAC5B,CAAC,CAAC;AApBW,QAAA,mBAAmB,uBAoB9B;AAEK,MAAM,qBAAqB,GAAG,CAAC,GAAoB,EAAW,EAAE,CACrE,GAAG,CAAC,MAAM,KAAK,KAAK;IACpB,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAF9D,QAAA,qBAAqB,yBAEyC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const markPreviewBridgeDocumentUncacheable: (proxyRes: IncomingMessage) => void;
|
|
3
|
+
export declare const createUserDevServerProxy: (userPort: number, userHost?: string, options?: {
|
|
4
|
+
isPreviewBridgeEnabled?: boolean;
|
|
5
|
+
expectedPreviewParentOrigin?: string;
|
|
6
|
+
}) => {
|
|
3
7
|
middleware: import("http-proxy-middleware").RequestHandler<IncomingMessage, ServerResponse<IncomingMessage>, (err?: any) => void>;
|
|
4
8
|
setVariantTarget: (port: number | null) => void;
|
|
5
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-config.d.ts","sourceRoot":"","sources":["../../src/proxy-middleware/proxy-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxy-config.d.ts","sourceRoot":"","sources":["../../src/proxy-middleware/proxy-config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAiB,MAAM,MAAM,CAAC;AAwB3E,eAAO,MAAM,oCAAoC,GAC/C,UAAU,eAAe,KACxB,IAEF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,UAAU,MAAM,EAChB,WAAU,MAAoB,EAC9B,UAAS;IACP,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACjC;;6BAgC0B,MAAM,GAAG,IAAI;CAkM9C,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUserDevServerProxy = void 0;
|
|
3
|
+
exports.createUserDevServerProxy = exports.markPreviewBridgeDocumentUncacheable = void 0;
|
|
4
4
|
const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
5
|
+
const crypto_1 = require("crypto");
|
|
5
6
|
const logger_1 = require("../utils/logger");
|
|
7
|
+
const preview_bridge_1 = require("./preview-bridge");
|
|
6
8
|
const log = (0, logger_1.createLogger)('ProxyConfig');
|
|
7
9
|
/**
|
|
8
10
|
* Satisfies http-proxy-middleware's required `target` option; real routing is
|
|
@@ -11,9 +13,14 @@ const log = (0, logger_1.createLogger)('ProxyConfig');
|
|
|
11
13
|
*/
|
|
12
14
|
const PROXY_LIBRARY_PLACEHOLDER_TARGET = 'http://127.0.0.1:9';
|
|
13
15
|
const hasValidUserDevPort = (userPort) => Number.isInteger(userPort) && userPort > 0;
|
|
14
|
-
const
|
|
16
|
+
const markPreviewBridgeDocumentUncacheable = (proxyRes) => {
|
|
17
|
+
proxyRes.headers['cache-control'] = 'no-cache, no-store';
|
|
18
|
+
};
|
|
19
|
+
exports.markPreviewBridgeDocumentUncacheable = markPreviewBridgeDocumentUncacheable;
|
|
20
|
+
const createUserDevServerProxy = (userPort, userHost = 'localhost', options = {}) => {
|
|
15
21
|
let variantTarget = null;
|
|
16
22
|
const hasDefaultUpstream = hasValidUserDevPort(userPort);
|
|
23
|
+
const isPreviewBridgeEnabled = options.isPreviewBridgeEnabled ?? false;
|
|
17
24
|
const defaultTarget = hasDefaultUpstream
|
|
18
25
|
? `http://${userHost}:${userPort}`
|
|
19
26
|
: null;
|
|
@@ -45,25 +52,58 @@ const createUserDevServerProxy = (userPort, userHost = 'localhost') => {
|
|
|
45
52
|
const nextLabel = next ?? defaultTarget ?? '(none)';
|
|
46
53
|
log.info(`setVariantTarget: ${prior} → ${nextLabel}`);
|
|
47
54
|
};
|
|
48
|
-
const
|
|
55
|
+
const prepareProxyResponseHeaders = (proxyRes) => {
|
|
56
|
+
// Allow iframe embedding by removing restrictive security headers
|
|
57
|
+
delete proxyRes.headers['x-frame-options'];
|
|
58
|
+
delete proxyRes.headers['content-security-policy-report-only'];
|
|
59
|
+
// Update Content-Security-Policy to allow iframe embedding
|
|
60
|
+
if (proxyRes.headers['content-security-policy']) {
|
|
61
|
+
const csp = proxyRes.headers['content-security-policy'];
|
|
62
|
+
if (typeof csp === 'string') {
|
|
63
|
+
// Remove frame-ancestors to allow embedding anywhere during development
|
|
64
|
+
proxyRes.headers['content-security-policy'] = csp.replace(/frame-ancestors[^;]*;?/, '');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const allowBridgeScriptInCsp = (proxyRes, scriptNonce) => {
|
|
69
|
+
const csp = proxyRes.headers['content-security-policy'];
|
|
70
|
+
if (typeof csp === 'string') {
|
|
71
|
+
proxyRes.headers['content-security-policy'] = (0, preview_bridge_1.allowPreviewBridgeNonceInCsp)(csp, { scriptNonce });
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (Array.isArray(csp)) {
|
|
75
|
+
proxyRes.headers['content-security-policy'] = csp.map((value) => (0, preview_bridge_1.allowPreviewBridgeNonceInCsp)(value, { scriptNonce }));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const createProxyOptions = (isHtmlTransformProxy) => ({
|
|
49
79
|
target: defaultTarget ?? PROXY_LIBRARY_PLACEHOLDER_TARGET,
|
|
50
80
|
router: () => getRouterTargetForLibrary(),
|
|
51
81
|
changeOrigin: true,
|
|
82
|
+
selfHandleResponse: isHtmlTransformProxy,
|
|
52
83
|
// No path rewriting needed when proxying all routes by default
|
|
53
84
|
on: {
|
|
54
|
-
proxyRes:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
85
|
+
proxyRes: isHtmlTransformProxy
|
|
86
|
+
? (0, http_proxy_middleware_1.responseInterceptor)(async (responseBuffer, proxyRes, req, _res) => {
|
|
87
|
+
prepareProxyResponseHeaders(proxyRes);
|
|
88
|
+
const contentType = proxyRes.headers['content-type'];
|
|
89
|
+
if (!(0, preview_bridge_1.shouldInjectPreviewBridge)({
|
|
90
|
+
method: req.method,
|
|
91
|
+
accept: req.headers.accept,
|
|
92
|
+
contentType,
|
|
93
|
+
})) {
|
|
94
|
+
return responseBuffer;
|
|
64
95
|
}
|
|
65
|
-
|
|
66
|
-
|
|
96
|
+
const scriptNonce = (0, crypto_1.randomBytes)(16).toString('base64');
|
|
97
|
+
allowBridgeScriptInCsp(proxyRes, scriptNonce);
|
|
98
|
+
(0, exports.markPreviewBridgeDocumentUncacheable)(proxyRes);
|
|
99
|
+
return (0, preview_bridge_1.injectPreviewBridge)(responseBuffer.toString('utf8'), {
|
|
100
|
+
expectedParentOrigin: options.expectedPreviewParentOrigin,
|
|
101
|
+
scriptNonce,
|
|
102
|
+
});
|
|
103
|
+
})
|
|
104
|
+
: (proxyRes, _req, _res) => {
|
|
105
|
+
prepareProxyResponseHeaders(proxyRes);
|
|
106
|
+
},
|
|
67
107
|
proxyReq: (proxyReq, req, _res) => {
|
|
68
108
|
// Preserve the original host for Next.js Server Actions
|
|
69
109
|
// Next.js checks that x-forwarded-host matches the origin header
|
|
@@ -94,8 +134,9 @@ const createUserDevServerProxy = (userPort, userHost = 'localhost') => {
|
|
|
94
134
|
// Timeout configurations
|
|
95
135
|
proxyTimeout: 30_000, // In MS
|
|
96
136
|
timeout: 30_000, // In MS
|
|
97
|
-
};
|
|
98
|
-
const proxyMiddlewareInstance = (0, http_proxy_middleware_1.createProxyMiddleware)(
|
|
137
|
+
});
|
|
138
|
+
const proxyMiddlewareInstance = (0, http_proxy_middleware_1.createProxyMiddleware)(createProxyOptions(false));
|
|
139
|
+
const htmlTransformProxyMiddlewareInstance = (0, http_proxy_middleware_1.createProxyMiddleware)(createProxyOptions(true));
|
|
99
140
|
const gatedHttp = (req, res, next) => {
|
|
100
141
|
const upstream = getActiveUpstream();
|
|
101
142
|
if (upstream === null) {
|
|
@@ -109,7 +150,10 @@ const createUserDevServerProxy = (userPort, userHost = 'localhost') => {
|
|
|
109
150
|
}
|
|
110
151
|
return;
|
|
111
152
|
}
|
|
112
|
-
|
|
153
|
+
const middleware = isPreviewBridgeEnabled && (0, preview_bridge_1.isHtmlDocumentRequest)(req)
|
|
154
|
+
? htmlTransformProxyMiddlewareInstance
|
|
155
|
+
: proxyMiddlewareInstance;
|
|
156
|
+
void middleware(req, res, next);
|
|
113
157
|
};
|
|
114
158
|
const gated = gatedHttp;
|
|
115
159
|
gated.upgrade = (req, socket, head) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-config.js","sourceRoot":"","sources":["../../src/proxy-middleware/proxy-config.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"proxy-config.js","sourceRoot":"","sources":["../../src/proxy-middleware/proxy-config.ts"],"names":[],"mappings":";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AAA,wBAAwB,4BAwOnC"}
|
|
@@ -3,5 +3,6 @@ import { type AgentVariantsOrchestrator } from '../mcp/agent-variants';
|
|
|
3
3
|
import type { SessionBridgeService } from '../services/SessionBridgeService';
|
|
4
4
|
import type { TelemetryService } from '../services/TelemetryService';
|
|
5
5
|
import { VariantHistoryService } from '../services/VariantHistoryService';
|
|
6
|
-
|
|
6
|
+
import { PrototypeDeployService } from '../services/PrototypeDeployService';
|
|
7
|
+
export declare const createAgentVariantsRouter: (orchestrator: AgentVariantsOrchestrator, bridge?: SessionBridgeService, telemetry?: TelemetryService, variantHistoryOverride?: VariantHistoryService, deployServiceOverride?: PrototypeDeployService) => Router;
|
|
7
8
|
//# sourceMappingURL=agentVariants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentVariants.d.ts","sourceRoot":"","sources":["../../src/routes/agentVariants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAA+B,MAAM,SAAS,CAAC;AAG9D,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,qBAAqB,EAGtB,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"agentVariants.d.ts","sourceRoot":"","sources":["../../src/routes/agentVariants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAA+B,MAAM,SAAS,CAAC;AAG9D,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,qBAAqB,EAGtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAwC5E,eAAO,MAAM,yBAAyB,GACpC,cAAc,yBAAyB,EACvC,SAAS,oBAAoB,EAC7B,YAAY,gBAAgB,EAC5B,yBAAyB,qBAAqB,EAC9C,wBAAwB,sBAAsB,KAC7C,MAgmBF,CAAC"}
|