rivet-design 0.14.17 → 0.14.19
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/agent-variants/WorktreeOrchestrator.d.ts +8 -17
- package/dist/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
- package/dist/agent-variants/WorktreeOrchestrator.js +60 -92
- package/dist/agent-variants/WorktreeOrchestrator.js.map +1 -1
- package/dist/agent-variants/contracts.d.ts +11 -13
- package/dist/agent-variants/contracts.d.ts.map +1 -1
- package/dist/agent-variants/contracts.js.map +1 -1
- package/dist/agent-variants/diffQa.d.ts +0 -4
- package/dist/agent-variants/diffQa.d.ts.map +1 -1
- package/dist/agent-variants/diffQa.js +4 -60
- package/dist/agent-variants/diffQa.js.map +1 -1
- package/dist/agent-variants/errors.d.ts +1 -1
- package/dist/agent-variants/errors.d.ts.map +1 -1
- package/dist/agent-variants/errors.js +1 -0
- package/dist/agent-variants/errors.js.map +1 -1
- package/dist/agent-variants/previewQa.d.ts +5 -52
- package/dist/agent-variants/previewQa.d.ts.map +1 -1
- package/dist/agent-variants/previewQa.js +12 -474
- package/dist/agent-variants/previewQa.js.map +1 -1
- package/dist/agent-variants/sourceContext.d.ts +1 -1
- package/dist/agent-variants/sourceContext.js +1 -1
- package/dist/agent-variants/workItemBriefing.d.ts +8 -1
- package/dist/agent-variants/workItemBriefing.d.ts.map +1 -1
- package/dist/agent-variants/workItemBriefing.js +32 -7
- package/dist/agent-variants/workItemBriefing.js.map +1 -1
- package/dist/cli/hostWorkNextAction.d.ts +3 -0
- package/dist/cli/hostWorkNextAction.d.ts.map +1 -1
- package/dist/cli/hostWorkNextAction.js +8 -2
- package/dist/cli/hostWorkNextAction.js.map +1 -1
- package/dist/services/TelemetryService.d.ts +5 -1
- package/dist/services/TelemetryService.d.ts.map +1 -1
- package/dist/services/TelemetryService.js +12 -1
- package/dist/services/TelemetryService.js.map +1 -1
- package/package.json +1 -1
- package/src/ui/dist/assets/main-BJDmnLTY.js +422 -0
- package/src/ui/dist/assets/main-Dad5qwqj.css +1 -0
- package/src/ui/dist/index.html +2 -2
- package/src/ui/dist/assets/main-C5tdh5OX.js +0 -422
- package/src/ui/dist/assets/main-CrLtwwgK.css +0 -1
|
@@ -1,495 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.runPreviewQa = runPreviewQa;
|
|
8
|
-
exports.extractExternalAssetUrls = extractExternalAssetUrls;
|
|
9
|
-
exports.extractLocalAssetPaths = extractLocalAssetPaths;
|
|
10
|
-
const dns_1 = __importDefault(require("dns"));
|
|
11
|
-
const fs_1 = __importDefault(require("fs"));
|
|
12
|
-
const http_1 = __importDefault(require("http"));
|
|
13
|
-
const https_1 = __importDefault(require("https"));
|
|
14
|
-
const path_1 = __importDefault(require("path"));
|
|
15
|
-
const sourceContext_1 = require("./sourceContext");
|
|
16
|
-
/**
|
|
17
|
-
* Preview QA — objective post-generation health checks for static-preview
|
|
18
|
-
* variants. The orchestrator runs this before accepting a `static_preview`
|
|
19
|
-
* succeeded report so a variant cannot enter `ready` while its referenced
|
|
20
|
-
* assets 404 or its runtime throws.
|
|
21
|
-
*
|
|
22
|
-
* The runner has two layers:
|
|
23
|
-
*
|
|
24
|
-
* 1. A pure static check that extracts external asset URLs from the
|
|
25
|
-
* generated HTML and fetches each one with a small timeout. This
|
|
26
|
-
* catches the most common failure mode (broken CDN URLs, missing
|
|
27
|
-
* `.glb` model assets) without needing a browser.
|
|
28
|
-
*
|
|
29
|
-
* 2. An injectable runtime check that can be wired to Playwright later
|
|
30
|
-
* to capture `pageerror` / `console.error` events. Tests stub this
|
|
31
|
-
* layer; production uses `DEFAULT_RUNTIME_QA_RUNNER` which is a
|
|
32
|
-
* no-op so the gate falls back to the static layer when no real
|
|
33
|
-
* runner is available.
|
|
34
|
-
*/
|
|
35
|
-
const DEFAULT_ASSET_TIMEOUT_MS = 4_000;
|
|
36
|
-
const LOCAL_ASSET_EXTENSIONS = new Set([
|
|
37
|
-
'.avif',
|
|
38
|
-
'.gif',
|
|
39
|
-
'.glb',
|
|
40
|
-
'.gltf',
|
|
41
|
-
'.jpg',
|
|
42
|
-
'.jpeg',
|
|
43
|
-
'.mp4',
|
|
44
|
-
'.png',
|
|
45
|
-
'.svg',
|
|
46
|
-
'.webm',
|
|
47
|
-
'.webp',
|
|
48
|
-
]);
|
|
49
|
-
/**
|
|
50
|
-
* No-op runtime QA runner used when no real (e.g. Playwright-based)
|
|
51
|
-
* runner is injected. Returns an empty issue list so the gate decision
|
|
52
|
-
* is driven entirely by the static asset layer.
|
|
53
|
-
*/
|
|
54
|
-
const DEFAULT_RUNTIME_QA_RUNNER = async () => [];
|
|
55
|
-
exports.DEFAULT_RUNTIME_QA_RUNNER = DEFAULT_RUNTIME_QA_RUNNER;
|
|
56
|
-
const MAX_REDIRECTS = 5;
|
|
57
|
-
/**
|
|
58
|
-
* Resolves a hostname to public addresses and returns the address that the
|
|
59
|
-
* subsequent HTTP request must use for its own lookup.
|
|
60
|
-
*
|
|
61
|
-
* @effect Performs a DNS lookup via dns.promises.lookup
|
|
62
|
-
*/
|
|
63
|
-
const resolvePinnedAddress = async (hostname) => {
|
|
64
|
-
if ((0, sourceContext_1.isLocalLiteralHostname)(hostname)) {
|
|
65
|
-
return {
|
|
66
|
-
kind: 'blocked',
|
|
67
|
-
message: `Host '${hostname}' resolves to a protected target.`,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
let addresses;
|
|
71
|
-
try {
|
|
72
|
-
addresses = await dns_1.default.promises.lookup(hostname, { all: true });
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
return {
|
|
76
|
-
kind: 'blocked',
|
|
77
|
-
message: `Host '${hostname}' could not be resolved safely.`,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
const protectedAddress = addresses.find(({ address }) => (0, sourceContext_1.isLocalLiteralHostname)(address));
|
|
81
|
-
if (protectedAddress) {
|
|
82
|
-
return {
|
|
83
|
-
kind: 'blocked',
|
|
84
|
-
message: `Host '${hostname}' resolves to a protected target.`,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
const address = addresses[0];
|
|
88
|
-
if (!address) {
|
|
89
|
-
return {
|
|
90
|
-
kind: 'blocked',
|
|
91
|
-
message: `Host '${hostname}' did not resolve to an address.`,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
kind: 'resolved',
|
|
96
|
-
address: {
|
|
97
|
-
address: address.address,
|
|
98
|
-
family: address.family === 6 ? 6 : 4,
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
const locationHeader = (headers) => {
|
|
103
|
-
const value = headers.location;
|
|
104
|
-
return Array.isArray(value) ? value[0] : value;
|
|
105
|
-
};
|
|
3
|
+
exports.runPreviewQa = void 0;
|
|
106
4
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* @effect Performs a network request to the validated asset URL
|
|
5
|
+
* Verifies that a worker produced a non-empty static preview artifact.
|
|
6
|
+
* Project-native checks remain the worker's responsibility; Rivet does not
|
|
7
|
+
* infer runtime validity by inspecting the artifact's implementation details.
|
|
111
8
|
*/
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
if (pinned.kind === 'blocked') {
|
|
116
|
-
return { kind: 'blocked', status: 0, message: pinned.message };
|
|
117
|
-
}
|
|
118
|
-
const lookup = (_hostname, _options, callback) => {
|
|
119
|
-
callback(null, pinned.address.address, pinned.address.family);
|
|
120
|
-
};
|
|
121
|
-
const transport = parsed.protocol === 'https:' ? https_1.default : http_1.default;
|
|
122
|
-
return new Promise((resolve, reject) => {
|
|
123
|
-
const request = transport.request({
|
|
124
|
-
protocol: parsed.protocol,
|
|
125
|
-
hostname: parsed.hostname,
|
|
126
|
-
port: parsed.port || undefined,
|
|
127
|
-
path: `${parsed.pathname}${parsed.search}`,
|
|
128
|
-
method: input.method,
|
|
129
|
-
headers: input.headers,
|
|
130
|
-
lookup,
|
|
131
|
-
signal: input.signal,
|
|
132
|
-
}, (response) => {
|
|
133
|
-
response.resume();
|
|
134
|
-
resolve({
|
|
135
|
-
kind: 'response',
|
|
136
|
-
response: {
|
|
137
|
-
status: response.statusCode ?? 0,
|
|
138
|
-
headers: response.headers,
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
request.on('error', reject);
|
|
143
|
-
request.end();
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
const DEFAULT_ASSET_PROBER = async (url, timeoutMs) => {
|
|
147
|
-
// SSRF guard: agent-supplied HTML can carry URLs pointing at localhost,
|
|
148
|
-
// RFC1918, link-local, or cloud-metadata hosts. Validate scheme +
|
|
149
|
-
// local-literal targets before issuing a network request, pin DNS for the
|
|
150
|
-
// request itself, and re-check after redirects.
|
|
151
|
-
const validation = (0, sourceContext_1.validateInspirationUrl)(url);
|
|
152
|
-
if (!validation.ok) {
|
|
153
|
-
return { ok: false, status: 0, message: validation.reason };
|
|
154
|
-
}
|
|
155
|
-
const controller = new AbortController();
|
|
156
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
157
|
-
const requestWithGuardedRedirects = async (initialUrl, init) => {
|
|
158
|
-
let currentUrl = initialUrl;
|
|
159
|
-
for (let hop = 0; hop <= MAX_REDIRECTS; hop += 1) {
|
|
160
|
-
const currentValidation = (0, sourceContext_1.validateInspirationUrl)(currentUrl);
|
|
161
|
-
if (!currentValidation.ok) {
|
|
162
|
-
return {
|
|
163
|
-
kind: 'blocked',
|
|
164
|
-
status: 0,
|
|
165
|
-
message: currentValidation.reason,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
const result = await requestAsset({
|
|
169
|
-
url: currentValidation.normalized,
|
|
170
|
-
method: init.method,
|
|
171
|
-
headers: init.headers,
|
|
172
|
-
signal: controller.signal,
|
|
173
|
-
});
|
|
174
|
-
if (result.kind === 'blocked')
|
|
175
|
-
return result;
|
|
176
|
-
const response = result.response;
|
|
177
|
-
const isRedirect = response.status >= 300 && response.status < 400;
|
|
178
|
-
const location = locationHeader(response.headers);
|
|
179
|
-
if (!isRedirect || !location) {
|
|
180
|
-
return { kind: 'response', response };
|
|
181
|
-
}
|
|
182
|
-
if (hop === MAX_REDIRECTS) {
|
|
183
|
-
return {
|
|
184
|
-
kind: 'blocked',
|
|
185
|
-
status: 0,
|
|
186
|
-
message: `Exceeded ${MAX_REDIRECTS} redirects probing asset.`,
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
// Resolve relative redirects against the URL we just hit.
|
|
190
|
-
let nextUrl;
|
|
191
|
-
try {
|
|
192
|
-
nextUrl = new URL(location, currentUrl);
|
|
193
|
-
}
|
|
194
|
-
catch {
|
|
195
|
-
return {
|
|
196
|
-
kind: 'blocked',
|
|
197
|
-
status: 0,
|
|
198
|
-
message: `Malformed redirect Location '${location}'.`,
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
currentUrl = nextUrl.toString();
|
|
202
|
-
}
|
|
203
|
-
return {
|
|
204
|
-
kind: 'blocked',
|
|
205
|
-
status: 0,
|
|
206
|
-
message: 'Redirect handling exhausted unexpectedly.',
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
try {
|
|
210
|
-
let result = await requestWithGuardedRedirects(validation.normalized, {
|
|
211
|
-
method: 'HEAD',
|
|
212
|
-
});
|
|
213
|
-
if (result.kind === 'blocked') {
|
|
214
|
-
return { ok: false, status: result.status, message: result.message };
|
|
215
|
-
}
|
|
216
|
-
let response = result.response;
|
|
217
|
-
// Some CDNs reject HEAD with 405 — fall back to a ranged GET.
|
|
218
|
-
if (response.status === 405 || response.status === 501) {
|
|
219
|
-
result = await requestWithGuardedRedirects(validation.normalized, {
|
|
220
|
-
method: 'GET',
|
|
221
|
-
headers: { Range: 'bytes=0-0' },
|
|
222
|
-
});
|
|
223
|
-
if (result.kind === 'blocked') {
|
|
224
|
-
return { ok: false, status: result.status, message: result.message };
|
|
225
|
-
}
|
|
226
|
-
response = result.response;
|
|
227
|
-
}
|
|
228
|
-
return {
|
|
229
|
-
ok: response.status >= 200 && response.status < 300,
|
|
230
|
-
status: response.status,
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
catch (err) {
|
|
234
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
235
|
-
return { ok: false, status: 0, message };
|
|
236
|
-
}
|
|
237
|
-
finally {
|
|
238
|
-
clearTimeout(timer);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
exports.DEFAULT_ASSET_PROBER = DEFAULT_ASSET_PROBER;
|
|
242
|
-
/**
|
|
243
|
-
* Run preview QA against a generated static-preview HTML document. The
|
|
244
|
-
* static layer extracts external asset URLs and local asset references; the
|
|
245
|
-
* injectable runtime layer adds console/runtime checks. Returns a single
|
|
246
|
-
* `VariantQaResult` with the combined verdict.
|
|
247
|
-
*/
|
|
248
|
-
async function runPreviewQa(input) {
|
|
249
|
-
const html = input.html;
|
|
250
|
-
if (typeof html !== 'string' || html.trim().length === 0) {
|
|
9
|
+
const runPreviewQa = async (input) => {
|
|
10
|
+
const source = input.options?.source;
|
|
11
|
+
if (typeof input.html !== 'string' || input.html.trim().length === 0) {
|
|
251
12
|
return {
|
|
252
13
|
status: 'failed',
|
|
253
14
|
issues: [
|
|
254
15
|
{
|
|
255
16
|
kind: 'preview_unavailable',
|
|
256
|
-
detail:
|
|
17
|
+
detail: source ?? 'inline',
|
|
257
18
|
message: 'Preview HTML was empty',
|
|
258
19
|
},
|
|
259
20
|
],
|
|
260
21
|
summary: 'Preview unavailable: generated HTML was empty.',
|
|
261
|
-
checkedSource: input.options?.source,
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
const assetProber = input.options?.assetProber ?? exports.DEFAULT_ASSET_PROBER;
|
|
265
|
-
const runtimeRunner = input.options?.runtimeQaRunner ?? exports.DEFAULT_RUNTIME_QA_RUNNER;
|
|
266
|
-
const assetTimeoutMs = input.options?.assetTimeoutMs ?? DEFAULT_ASSET_TIMEOUT_MS;
|
|
267
|
-
const source = input.options?.source;
|
|
268
|
-
const localAssetBasePath = input.options?.localAssetBasePath;
|
|
269
|
-
const issues = [];
|
|
270
|
-
const blockingAssetDetails = new Set();
|
|
271
|
-
const assetUrls = extractExternalAssetUrls(html);
|
|
272
|
-
await Promise.all(assetUrls.map(async (url) => {
|
|
273
|
-
const result = await assetProber(url, assetTimeoutMs);
|
|
274
|
-
if (!result.ok) {
|
|
275
|
-
issues.push({
|
|
276
|
-
kind: 'asset_load_failed',
|
|
277
|
-
detail: url,
|
|
278
|
-
message: result.status > 0
|
|
279
|
-
? `HTTP ${result.status}`
|
|
280
|
-
: result.message ?? 'Network error',
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
}));
|
|
284
|
-
const localAssetPaths = extractLocalAssetPaths(html);
|
|
285
|
-
for (const assetPath of localAssetPaths) {
|
|
286
|
-
const validation = validateLocalAssetReference(assetPath, localAssetBasePath);
|
|
287
|
-
if (!validation.ok) {
|
|
288
|
-
blockingAssetDetails.add(assetPath);
|
|
289
|
-
issues.push({
|
|
290
|
-
kind: 'asset_load_failed',
|
|
291
|
-
detail: assetPath,
|
|
292
|
-
message: validation.message,
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
try {
|
|
297
|
-
const runtimeIssues = await runtimeRunner({ html, source: source ?? 'inline' });
|
|
298
|
-
for (const issue of runtimeIssues) {
|
|
299
|
-
issues.push(issue);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
catch (err) {
|
|
303
|
-
issues.push({
|
|
304
|
-
kind: 'console_error',
|
|
305
|
-
detail: 'runtime_qa_runner',
|
|
306
|
-
message: err instanceof Error ? err.message : String(err),
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
// External-asset probe failures don't block — the user's browser fetches
|
|
310
|
-
// these directly when viewing the preview, so a server-side reachability
|
|
311
|
-
// failure (e.g. IPv6/SSRF-guard edge cases on fonts.googleapis.com) doesn't
|
|
312
|
-
// predict whether the iframe will render. Local asset failures do block:
|
|
313
|
-
// if the generated static preview references `./hero.png` and no sibling
|
|
314
|
-
// file exists in the asset base, the iframe has nowhere to load it from.
|
|
315
|
-
const blockingIssues = issues.filter((issue) => issue.kind !== 'asset_load_failed' ||
|
|
316
|
-
(issue.detail ? blockingAssetDetails.has(issue.detail) : false));
|
|
317
|
-
if (blockingIssues.length === 0) {
|
|
318
|
-
const assetIssueCount = issues.length;
|
|
319
|
-
return {
|
|
320
|
-
status: 'passed',
|
|
321
|
-
issues,
|
|
322
|
-
summary: assetIssueCount === 0
|
|
323
|
-
? 'Preview QA passed — assets reachable, no runtime errors.'
|
|
324
|
-
: `Preview QA passed — ${assetIssueCount} external asset${assetIssueCount === 1 ? '' : 's'} unreachable from server (browser will fetch independently).`,
|
|
325
22
|
checkedSource: source,
|
|
326
23
|
};
|
|
327
24
|
}
|
|
328
25
|
return {
|
|
329
|
-
status: '
|
|
330
|
-
issues,
|
|
331
|
-
summary:
|
|
26
|
+
status: 'passed',
|
|
27
|
+
issues: [],
|
|
28
|
+
summary: 'Preview integrity passed.',
|
|
332
29
|
checkedSource: source,
|
|
333
30
|
};
|
|
334
|
-
}
|
|
335
|
-
const buildIssueSummary = (issues) => {
|
|
336
|
-
const counts = {
|
|
337
|
-
asset_load_failed: 0,
|
|
338
|
-
console_error: 0,
|
|
339
|
-
preview_unavailable: 0,
|
|
340
|
-
design_quality: 0,
|
|
341
|
-
};
|
|
342
|
-
for (const issue of issues) {
|
|
343
|
-
counts[issue.kind] += 1;
|
|
344
|
-
}
|
|
345
|
-
const fragments = [];
|
|
346
|
-
if (counts.asset_load_failed > 0) {
|
|
347
|
-
const first = issues.find((i) => i.kind === 'asset_load_failed');
|
|
348
|
-
fragments.push(counts.asset_load_failed === 1
|
|
349
|
-
? `asset failed to load (${first?.detail ?? 'unknown'})`
|
|
350
|
-
: `${counts.asset_load_failed} assets failed to load`);
|
|
351
|
-
}
|
|
352
|
-
if (counts.console_error > 0) {
|
|
353
|
-
fragments.push(counts.console_error === 1
|
|
354
|
-
? '1 console/runtime error detected'
|
|
355
|
-
: `${counts.console_error} console/runtime errors detected`);
|
|
356
|
-
}
|
|
357
|
-
if (counts.preview_unavailable > 0) {
|
|
358
|
-
fragments.push('preview unavailable');
|
|
359
|
-
}
|
|
360
|
-
return `Preview QA failed: ${fragments.join('; ')}.`;
|
|
361
|
-
};
|
|
362
|
-
/**
|
|
363
|
-
* Extract external asset URLs from a generated HTML document. Pulls from
|
|
364
|
-
* the common attributes (`src`, `href`, `poster`, `data-*` images) and
|
|
365
|
-
* inline CSS `url(...)` references. Keeps only http(s) URLs; local asset
|
|
366
|
-
* references are validated separately against the static preview asset base.
|
|
367
|
-
*/
|
|
368
|
-
function extractExternalAssetUrls(html) {
|
|
369
|
-
const seen = new Set();
|
|
370
|
-
const push = (raw) => {
|
|
371
|
-
if (!raw)
|
|
372
|
-
return;
|
|
373
|
-
const trimmed = raw.trim();
|
|
374
|
-
if (!trimmed)
|
|
375
|
-
return;
|
|
376
|
-
if (!/^https?:\/\//i.test(trimmed))
|
|
377
|
-
return;
|
|
378
|
-
seen.add(trimmed);
|
|
379
|
-
};
|
|
380
|
-
const attributeRegex = /\b(?:src|href|poster|data-src|data-href|data-image|model-src)\s*=\s*("|')([^"']+)\1/gi;
|
|
381
|
-
let attrMatch;
|
|
382
|
-
while ((attrMatch = attributeRegex.exec(html))) {
|
|
383
|
-
push(attrMatch[2]);
|
|
384
|
-
}
|
|
385
|
-
// <link rel="stylesheet" href="..."> is already covered above; capture
|
|
386
|
-
// <img srcset> entries here. srcset is a comma list of "url descriptor".
|
|
387
|
-
const srcsetRegex = /\bsrcset\s*=\s*("|')([^"']+)\1/gi;
|
|
388
|
-
let srcsetMatch;
|
|
389
|
-
while ((srcsetMatch = srcsetRegex.exec(html))) {
|
|
390
|
-
const list = srcsetMatch[2];
|
|
391
|
-
for (const entry of list.split(',')) {
|
|
392
|
-
const url = entry.trim().split(/\s+/)[0];
|
|
393
|
-
push(url);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
// Inline CSS `url(...)` references (background-image, etc.). Strip
|
|
397
|
-
// surrounding quotes if present.
|
|
398
|
-
const cssUrlRegex = /url\(\s*("|'|)([^"')]+)\1\s*\)/gi;
|
|
399
|
-
let cssMatch;
|
|
400
|
-
while ((cssMatch = cssUrlRegex.exec(html))) {
|
|
401
|
-
push(cssMatch[2]);
|
|
402
|
-
}
|
|
403
|
-
return [...seen];
|
|
404
|
-
}
|
|
405
|
-
function extractLocalAssetPaths(html) {
|
|
406
|
-
const seen = new Set();
|
|
407
|
-
const push = (raw) => {
|
|
408
|
-
if (!raw)
|
|
409
|
-
return;
|
|
410
|
-
const trimmed = raw.trim();
|
|
411
|
-
if (!trimmed || !isLocalAssetReference(trimmed))
|
|
412
|
-
return;
|
|
413
|
-
seen.add(trimmed);
|
|
414
|
-
};
|
|
415
|
-
const attributeRegex = /\b(?:src|href|poster|data-src|data-href|data-image|model-src)\s*=\s*("|')([^"']+)\1/gi;
|
|
416
|
-
let attrMatch;
|
|
417
|
-
while ((attrMatch = attributeRegex.exec(html))) {
|
|
418
|
-
push(attrMatch[2]);
|
|
419
|
-
}
|
|
420
|
-
const srcsetRegex = /\bsrcset\s*=\s*("|')([^"']+)\1/gi;
|
|
421
|
-
let srcsetMatch;
|
|
422
|
-
while ((srcsetMatch = srcsetRegex.exec(html))) {
|
|
423
|
-
const list = srcsetMatch[2];
|
|
424
|
-
for (const entry of list.split(',')) {
|
|
425
|
-
const url = entry.trim().split(/\s+/)[0];
|
|
426
|
-
push(url);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
const cssUrlRegex = /url\(\s*("|'|)([^"')]+)\1\s*\)/gi;
|
|
430
|
-
let cssMatch;
|
|
431
|
-
while ((cssMatch = cssUrlRegex.exec(html))) {
|
|
432
|
-
push(cssMatch[2]);
|
|
433
|
-
}
|
|
434
|
-
return [...seen];
|
|
435
|
-
}
|
|
436
|
-
const isLocalAssetReference = (raw) => {
|
|
437
|
-
if (/^(?:https?:|data:|blob:|mailto:|tel:|javascript:)/i.test(raw)) {
|
|
438
|
-
return false;
|
|
439
|
-
}
|
|
440
|
-
if (raw.startsWith('#') || raw.startsWith('//'))
|
|
441
|
-
return false;
|
|
442
|
-
let pathname;
|
|
443
|
-
try {
|
|
444
|
-
pathname = new URL(raw, 'http://rivet.local').pathname;
|
|
445
|
-
}
|
|
446
|
-
catch {
|
|
447
|
-
return false;
|
|
448
|
-
}
|
|
449
|
-
const extension = path_1.default.extname(pathname).toLowerCase();
|
|
450
|
-
return LOCAL_ASSET_EXTENSIONS.has(extension);
|
|
451
|
-
};
|
|
452
|
-
const normalizeLocalAssetPath = (raw) => {
|
|
453
|
-
try {
|
|
454
|
-
const pathOnly = raw.trim().split(/[?#]/)[0] ?? '';
|
|
455
|
-
const decoded = decodeURIComponent(pathOnly);
|
|
456
|
-
return decoded.startsWith('/') ? decoded.replace(/^\/+/, '') : decoded;
|
|
457
|
-
}
|
|
458
|
-
catch {
|
|
459
|
-
return null;
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
const validateLocalAssetReference = (raw, localAssetBasePath) => {
|
|
463
|
-
if (!localAssetBasePath) {
|
|
464
|
-
return {
|
|
465
|
-
ok: false,
|
|
466
|
-
message: 'Local asset reference has no static preview asset base; copy the file or inline the asset.',
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
const relativePath = normalizeLocalAssetPath(raw);
|
|
470
|
-
if (!relativePath) {
|
|
471
|
-
return { ok: false, message: 'Local asset reference is malformed.' };
|
|
472
|
-
}
|
|
473
|
-
const base = path_1.default.resolve(localAssetBasePath);
|
|
474
|
-
const target = path_1.default.resolve(base, relativePath);
|
|
475
|
-
if (target !== base && !target.startsWith(base + path_1.default.sep)) {
|
|
476
|
-
return {
|
|
477
|
-
ok: false,
|
|
478
|
-
message: 'Local asset reference escapes the static preview asset base.',
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
try {
|
|
482
|
-
const stat = fs_1.default.statSync(target);
|
|
483
|
-
if (!stat.isFile()) {
|
|
484
|
-
return { ok: false, message: 'Local asset reference is not a file.' };
|
|
485
|
-
}
|
|
486
|
-
return { ok: true };
|
|
487
|
-
}
|
|
488
|
-
catch {
|
|
489
|
-
return {
|
|
490
|
-
ok: false,
|
|
491
|
-
message: 'Local asset reference was not found in the static preview.',
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
31
|
};
|
|
32
|
+
exports.runPreviewQa = runPreviewQa;
|
|
495
33
|
//# sourceMappingURL=previewQa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewQa.js","sourceRoot":"","sources":["../../src/agent-variants/previewQa.ts"],"names":[],"mappings":";;;;;;AA4UA,oCA0GC;AAwCD,4DAqCC;AAED,wDAiCC;AAtiBD,8CAAsB;AACtB,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAE1B,gDAAwB;AAMxB,mDAGyB;AAEzB;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,wBAAwB,GAAG,KAAK,CAAC;AACvC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IACrC,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;CACR,CAAC,CAAC;AAmBH;;;;GAIG;AACI,MAAM,yBAAyB,GAAoB,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;AAA5D,QAAA,yBAAyB,6BAAmC;AAsBzE,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;;;;GAKG;AAC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AAM,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;IACrC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrE,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,qBAAqB;oBAC3B,MAAM,EAAE,MAAM,IAAI,QAAQ;oBAC1B,OAAO,EAAE,wBAAwB;iBAClC;aACF;YACD,OAAO,EAAE,gDAAgD;YACzD,aAAa,EAAE,MAAM;SACtB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,2BAA2B;QACpC,aAAa,EAAE,MAAM;KACtB,CAAC;AACJ,CAAC,CAAC;AAzBW,QAAA,YAAY,gBAyBvB"}
|
|
@@ -7,7 +7,7 @@ export declare const isLocalLiteralHostname: (hostname: string) => boolean;
|
|
|
7
7
|
/**
|
|
8
8
|
* Synchronous URL validator: enforces HTTP/HTTPS scheme and rejects literal
|
|
9
9
|
* hostnames that match local/loopback/link-local patterns. Used as the SSRF
|
|
10
|
-
* guard for
|
|
10
|
+
* guard for visual reference URLs.
|
|
11
11
|
*/
|
|
12
12
|
export declare const validateInspirationUrl: (rawUrl: string) => {
|
|
13
13
|
ok: true;
|
|
@@ -66,7 +66,7 @@ exports.isLocalLiteralHostname = isLocalLiteralHostname;
|
|
|
66
66
|
/**
|
|
67
67
|
* Synchronous URL validator: enforces HTTP/HTTPS scheme and rejects literal
|
|
68
68
|
* hostnames that match local/loopback/link-local patterns. Used as the SSRF
|
|
69
|
-
* guard for
|
|
69
|
+
* guard for visual reference URLs.
|
|
70
70
|
*/
|
|
71
71
|
const validateInspirationUrl = (rawUrl) => {
|
|
72
72
|
const trimmed = rawUrl.trim();
|
|
@@ -19,10 +19,17 @@ import type { HostVariantImplementationWorkItemSnapshot } from './contracts';
|
|
|
19
19
|
* compose the pointer without filesystem access.
|
|
20
20
|
*/
|
|
21
21
|
export declare const workItemBriefingPath: (sessionId: string, workId: string) => string;
|
|
22
|
-
|
|
22
|
+
type WorkItemCompleteCommandContext = {
|
|
23
|
+
projectPath?: string;
|
|
24
|
+
sessionId?: string;
|
|
25
|
+
};
|
|
26
|
+
/** Builds the command that reports one host-owned work item complete. */
|
|
27
|
+
export declare const workItemCompleteCommand: (workId: string, context?: WorkItemCompleteCommandContext) => string;
|
|
23
28
|
/** The ~40-token prompt the coordinator passes to each worker verbatim. */
|
|
24
29
|
export declare const workItemWorkerPrompt: (sessionId: string, item: HostVariantImplementationWorkItemSnapshot) => string;
|
|
25
30
|
export declare const renderWorkItemBriefing: (item: HostVariantImplementationWorkItemSnapshot, options?: {
|
|
26
31
|
completion?: "self" | "executor";
|
|
32
|
+
completionCommand?: WorkItemCompleteCommandContext;
|
|
27
33
|
}) => string;
|
|
34
|
+
export {};
|
|
28
35
|
//# sourceMappingURL=workItemBriefing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workItemBriefing.d.ts","sourceRoot":"","sources":["../../src/agent-variants/workItemBriefing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,aAAa,CAAC;AAK7E;;;;;;;;;;;;;;;;;;GAkBG;AAEH,eAAO,MAAM,oBAAoB,GAC/B,WAAW,MAAM,EACjB,QAAQ,MAAM,KACb,MACwE,CAAC;AAE5E,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"workItemBriefing.d.ts","sourceRoot":"","sources":["../../src/agent-variants/workItemBriefing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,aAAa,CAAC;AAK7E;;;;;;;;;;;;;;;;;;GAkBG;AAEH,eAAO,MAAM,oBAAoB,GAC/B,WAAW,MAAM,EACjB,QAAQ,MAAM,KACb,MACwE,CAAC;AAE5E,KAAK,8BAA8B,GAAG;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAQF,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,GAClC,QAAQ,MAAM,EACd,UAAU,8BAA8B,KACvC,MAaW,CAAC;AAEf,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB,GAC/B,WAAW,MAAM,EACjB,MAAM,yCAAyC,KAC9C,MAG4E,CAAC;AAwChF,eAAO,MAAM,sBAAsB,GACjC,MAAM,yCAAyC,EAC/C,UAAU;IACR,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACjC,iBAAiB,CAAC,EAAE,8BAA8B,CAAC;CACpD,KACA,MA4NF,CAAC"}
|