@agent-native/core 0.90.3 → 0.90.4
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/bin/agent-native.js +25 -3
- package/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +9 -0
- package/corpus/core/bin/agent-native.js +25 -3
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/engine/index.ts +1 -0
- package/corpus/core/src/agent/engine/registry.ts +63 -2
- package/corpus/core/src/cli/create.ts +35 -0
- package/corpus/core/src/cli/design-connect.ts +248 -0
- package/corpus/core/src/cli/index.ts +84 -7
- package/corpus/core/src/cli/workspacify.ts +34 -0
- package/corpus/core/src/client/history/VersionHistoryPanel.tsx +77 -47
- package/corpus/core/src/client/history/index.ts +3 -0
- package/corpus/core/src/client/history/use-history.ts +28 -0
- package/corpus/core/src/client/index.ts +8 -0
- package/corpus/core/src/client/review/index.ts +5 -0
- package/corpus/core/src/client/review/use-review.ts +40 -2
- package/corpus/core/src/history/actions/create-resource-version.ts +11 -8
- package/corpus/core/src/history/index.ts +0 -1
- package/corpus/core/src/history/registry.ts +24 -12
- package/corpus/core/src/history/store.ts +84 -53
- package/corpus/core/src/review/actions/consume-review-feedback.ts +15 -5
- package/corpus/core/src/review/actions/delete-review-comment.ts +15 -3
- package/corpus/core/src/review/actions/resolve-review-thread.ts +12 -5
- package/corpus/core/src/review/index.ts +0 -5
- package/corpus/core/src/review/registry.ts +24 -12
- package/corpus/core/src/review/store.ts +10 -7
- package/corpus/core/src/server/agent-chat-plugin.ts +6 -0
- package/corpus/core/src/server/credential-provider.ts +13 -3
- package/corpus/templates/assets/actions/_preset-skeleton-validation.ts +11 -11
- package/corpus/templates/assets/actions/generate-image.ts +64 -28
- package/corpus/templates/assets/app/components/generation/GenerationResults.tsx +1 -1
- package/corpus/templates/assets/app/routes/brand-kits.$id_.presets.$presetId.tsx +91 -74
- package/corpus/templates/assets/server/lib/generation.ts +29 -4
- package/corpus/templates/assets/server/lib/image-processing.ts +131 -0
- package/corpus/templates/calendar/.agents/skills/event-management/SKILL.md +24 -2
- package/corpus/templates/calendar/AGENTS.md +3 -0
- package/corpus/templates/calendar/actions/create-event.ts +8 -34
- package/corpus/templates/calendar/actions/event-action-helpers.ts +52 -0
- package/corpus/templates/calendar/actions/manage-event-draft.ts +7 -34
- package/corpus/templates/calendar/actions/update-event.ts +10 -23
- package/corpus/templates/calendar/app/components/calendar/AttendeeAutocomplete.tsx +47 -0
- package/corpus/templates/calendar/app/components/calendar/CreateEventDialog.tsx +23 -0
- package/corpus/templates/calendar/app/components/calendar/EventAttendeesSection.tsx +59 -2
- package/corpus/templates/calendar/app/components/calendar/EventDetailPanel.tsx +40 -1
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +34 -1
- package/corpus/templates/calendar/app/hooks/use-events.ts +6 -0
- package/corpus/templates/calendar/app/i18n/zh-TW.ts +4 -0
- package/corpus/templates/calendar/app/i18n-data.ts +40 -0
- package/corpus/templates/calendar/changelog/2026-07-07-you-can-mark-event-guests-as-optional-while-inviting-them-or.md +6 -0
- package/corpus/templates/calendar/server/handlers/events.ts +1 -0
- package/corpus/templates/calendar/server/lib/google-calendar.ts +4 -0
- package/corpus/templates/calendar/server/plugins/agent-chat.ts +1 -1
- package/corpus/templates/calendar/shared/api.ts +2 -0
- package/corpus/templates/clips/.agents/skills/ai-video-tools/SKILL.md +29 -3
- package/corpus/templates/clips/actions/generate-workflow.ts +19 -8
- package/corpus/templates/clips/actions/get-clips-ai-prefs.ts +36 -0
- package/corpus/templates/clips/actions/lib/clips-ai-prefs.ts +28 -0
- package/corpus/templates/clips/actions/regenerate-chapters.ts +21 -7
- package/corpus/templates/clips/actions/regenerate-summary.ts +26 -8
- package/corpus/templates/clips/actions/regenerate-title.ts +44 -7
- package/corpus/templates/clips/actions/update-clips-ai-prefs.ts +50 -0
- package/corpus/templates/clips/app/components/meetings/meeting-card.tsx +7 -2
- package/corpus/templates/clips/app/hooks/use-auto-title.ts +25 -10
- package/corpus/templates/clips/app/i18n/ar-SA.ts +28 -6
- package/corpus/templates/clips/app/i18n/de-DE.ts +28 -6
- package/corpus/templates/clips/app/i18n/en-US.ts +29 -6
- package/corpus/templates/clips/app/i18n/es-ES.ts +29 -6
- package/corpus/templates/clips/app/i18n/fr-FR.ts +30 -6
- package/corpus/templates/clips/app/i18n/hi-IN.ts +26 -6
- package/corpus/templates/clips/app/i18n/ja-JP.ts +27 -6
- package/corpus/templates/clips/app/i18n/ko-KR.ts +28 -6
- package/corpus/templates/clips/app/i18n/pt-BR.ts +28 -6
- package/corpus/templates/clips/app/i18n/zh-CN.ts +26 -6
- package/corpus/templates/clips/app/i18n/zh-TW.ts +25 -6
- package/corpus/templates/clips/app/routes/_app.meetings._index.tsx +73 -0
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +1 -0
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +70 -2
- package/corpus/templates/clips/changelog/2026-07-07-ai-tools-can-include-the-full-video-not-just-the-transcript-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-07-clips-desktop-now-surfaces-meetings-and-dictate-directly-in-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-07-meeting-notes-now-explain-exactly-how-to-start-granola-style.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-07-meeting-start-alerts-now-include-separate-start-notes-and-jo.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-07-recordings-start-more-predictably-and-newly-saved-clips-refr.md +6 -0
- package/corpus/templates/clips/chrome-extension/public/manifest.json +1 -1
- package/corpus/templates/clips/desktop/src/app.tsx +435 -105
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +27 -21
- package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +23 -22
- package/corpus/templates/clips/desktop/src/styles.css +167 -2
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +1 -1
- package/corpus/templates/clips/desktop/src-tauri/src/notifications.rs +3 -7
- package/corpus/templates/clips/desktop/src-tauri/src/tray_meetings.rs +5 -4
- package/corpus/templates/clips/server/routes/_agent-native/clips/user-prefs.put.ts +16 -8
- package/corpus/templates/clips/shared/clips-ai-prefs.ts +81 -0
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +16 -1
- package/corpus/templates/design/actions/add-localhost-screens.ts +1 -0
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +345 -11
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +89 -14
- package/corpus/templates/design/app/components/design/bridge-security.ts +7 -1
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +1 -1
- package/corpus/templates/design/app/i18n/zh-TW.ts +3 -0
- package/corpus/templates/design/app/i18n-data.ts +41 -0
- package/corpus/templates/design/changelog/2026-07-07-local-visual-edit-uses-live-app-iframes-for-click-to-edit-pr.md +6 -0
- package/dist/agent/engine/index.d.ts +1 -1
- package/dist/agent/engine/index.d.ts.map +1 -1
- package/dist/agent/engine/index.js +1 -1
- package/dist/agent/engine/index.js.map +1 -1
- package/dist/agent/engine/registry.d.ts +14 -0
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +56 -2
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +31 -0
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +186 -0
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/cli/index.js +76 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/workspacify.d.ts.map +1 -1
- package/dist/cli/workspacify.js +30 -0
- package/dist/cli/workspacify.js.map +1 -1
- package/dist/client/history/VersionHistoryPanel.d.ts +1 -1
- package/dist/client/history/VersionHistoryPanel.d.ts.map +1 -1
- package/dist/client/history/VersionHistoryPanel.js +12 -5
- package/dist/client/history/VersionHistoryPanel.js.map +1 -1
- package/dist/client/history/index.d.ts +1 -1
- package/dist/client/history/index.d.ts.map +1 -1
- package/dist/client/history/index.js +1 -1
- package/dist/client/history/index.js.map +1 -1
- package/dist/client/history/use-history.d.ts +12 -0
- package/dist/client/history/use-history.d.ts.map +1 -1
- package/dist/client/history/use-history.js +6 -0
- package/dist/client/history/use-history.js.map +1 -1
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/review/index.d.ts +1 -1
- package/dist/client/review/index.d.ts.map +1 -1
- package/dist/client/review/index.js +1 -1
- package/dist/client/review/index.js.map +1 -1
- package/dist/client/review/use-review.d.ts +23 -0
- package/dist/client/review/use-review.d.ts.map +1 -1
- package/dist/client/review/use-review.js +8 -0
- package/dist/client/review/use-review.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/history/actions/create-resource-version.js +7 -4
- package/dist/history/actions/create-resource-version.js.map +1 -1
- package/dist/history/index.d.ts +1 -1
- package/dist/history/index.d.ts.map +1 -1
- package/dist/history/index.js +1 -1
- package/dist/history/index.js.map +1 -1
- package/dist/history/registry.d.ts.map +1 -1
- package/dist/history/registry.js +14 -12
- package/dist/history/registry.js.map +1 -1
- package/dist/history/store.d.ts.map +1 -1
- package/dist/history/store.js +74 -49
- package/dist/history/store.js.map +1 -1
- package/dist/observability/routes.d.ts +3 -3
- package/dist/progress/routes.d.ts +1 -1
- package/dist/review/actions/consume-review-feedback.d.ts +1 -0
- package/dist/review/actions/consume-review-feedback.js +8 -2
- package/dist/review/actions/consume-review-feedback.js.map +1 -1
- package/dist/review/actions/delete-review-comment.d.ts +2 -1
- package/dist/review/actions/delete-review-comment.js +11 -3
- package/dist/review/actions/delete-review-comment.js.map +1 -1
- package/dist/review/actions/resolve-review-thread.d.ts +2 -1
- package/dist/review/actions/resolve-review-thread.js +5 -2
- package/dist/review/actions/resolve-review-thread.js.map +1 -1
- package/dist/review/index.d.ts +1 -1
- package/dist/review/index.d.ts.map +1 -1
- package/dist/review/index.js +1 -1
- package/dist/review/index.js.map +1 -1
- package/dist/review/registry.d.ts.map +1 -1
- package/dist/review/registry.js +14 -12
- package/dist/review/registry.js.map +1 -1
- package/dist/review/store.d.ts +3 -3
- package/dist/review/store.d.ts.map +1 -1
- package/dist/review/store.js +7 -4
- package/dist/review/store.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +5 -0
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts +2 -0
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +13 -3
- package/dist/server/credential-provider.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-connect.d.ts","sourceRoot":"","sources":["../../src/cli/design-connect.ts"],"names":[],"mappings":"AAIA,OAAa,EAEX,KAAK,MAAM,EAEZ,MAAM,WAAW,CAAC;AAcnB,QAAA,MAAM,iBAAiB,YACrB,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,WAAW,CACH,CAAC;AAEX,KAAK,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,kFAAkF;AAClF,QAAA,MAAM,qBAAqB;aACzB,SAAS;aACT,aAAa;aACb,cAAc;CACN,CAAC;AAEX,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;mFAG+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;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,CAsDf;AAuHD,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,mBAwD7C"}
|
|
@@ -414,6 +414,36 @@ function sendJson(res, statusCode, body) {
|
|
|
414
414
|
});
|
|
415
415
|
res.end(`${JSON.stringify(body, null, 2)}\n`);
|
|
416
416
|
}
|
|
417
|
+
function sendText(res, statusCode, body, contentType) {
|
|
418
|
+
res.writeHead(statusCode, {
|
|
419
|
+
"content-type": contentType,
|
|
420
|
+
"access-control-allow-origin": "*",
|
|
421
|
+
"access-control-allow-methods": "GET, POST, OPTIONS",
|
|
422
|
+
"access-control-allow-headers": "content-type, x-bridge-token",
|
|
423
|
+
"access-control-allow-private-network": "true",
|
|
424
|
+
});
|
|
425
|
+
res.end(body);
|
|
426
|
+
}
|
|
427
|
+
function sendBytes(res, statusCode, body, headers) {
|
|
428
|
+
const responseHeaders = {
|
|
429
|
+
"access-control-allow-origin": "*",
|
|
430
|
+
"access-control-allow-methods": "GET, HEAD, POST, OPTIONS",
|
|
431
|
+
"access-control-allow-headers": "content-type, x-bridge-token",
|
|
432
|
+
"access-control-allow-private-network": "true",
|
|
433
|
+
};
|
|
434
|
+
for (const name of [
|
|
435
|
+
"content-type",
|
|
436
|
+
"cache-control",
|
|
437
|
+
"etag",
|
|
438
|
+
"last-modified",
|
|
439
|
+
]) {
|
|
440
|
+
const value = headers.get(name);
|
|
441
|
+
if (value)
|
|
442
|
+
responseHeaders[name] = value;
|
|
443
|
+
}
|
|
444
|
+
res.writeHead(statusCode, responseHeaders);
|
|
445
|
+
res.end(body);
|
|
446
|
+
}
|
|
417
447
|
function sameOrigin(a, b) {
|
|
418
448
|
try {
|
|
419
449
|
return new URL(a).origin === new URL(b).origin;
|
|
@@ -434,6 +464,16 @@ function resolvePreviewSnapshotUrl(devServerUrl, rawUrl) {
|
|
|
434
464
|
}
|
|
435
465
|
return parsed.toString();
|
|
436
466
|
}
|
|
467
|
+
function resolvePreviewProxyUrl(devServerUrl, requestUrl) {
|
|
468
|
+
const base = normalizeHttpUrl(devServerUrl);
|
|
469
|
+
const parsedRequest = new URL(requestUrl ?? "/", base);
|
|
470
|
+
const parsed = new URL(`${parsedRequest.pathname}${parsedRequest.search}`, `${base}/`);
|
|
471
|
+
parsed.hash = "";
|
|
472
|
+
if (!sameOrigin(parsed.toString(), base)) {
|
|
473
|
+
throw new Error("Proxy URL must stay on the connected dev server.");
|
|
474
|
+
}
|
|
475
|
+
return parsed.toString();
|
|
476
|
+
}
|
|
437
477
|
async function fetchPreviewSnapshot(devServerUrl, targetUrl, redirects = 0) {
|
|
438
478
|
if (redirects > 5) {
|
|
439
479
|
throw new Error("Too many redirects while fetching preview snapshot.");
|
|
@@ -469,6 +509,63 @@ async function fetchPreviewSnapshot(devServerUrl, targetUrl, redirects = 0) {
|
|
|
469
509
|
clearTimeout(timeout);
|
|
470
510
|
}
|
|
471
511
|
}
|
|
512
|
+
async function fetchPreviewProxyResource(devServerUrl, targetUrl, redirects = 0) {
|
|
513
|
+
if (redirects > 5) {
|
|
514
|
+
throw new Error("Too many redirects while proxying preview resource.");
|
|
515
|
+
}
|
|
516
|
+
const controller = new AbortController();
|
|
517
|
+
const timeout = setTimeout(() => controller.abort(), 10_000);
|
|
518
|
+
try {
|
|
519
|
+
const response = await fetch(targetUrl, {
|
|
520
|
+
method: "GET",
|
|
521
|
+
redirect: "manual",
|
|
522
|
+
signal: controller.signal,
|
|
523
|
+
});
|
|
524
|
+
const location = response.headers.get("location");
|
|
525
|
+
if (location && response.status >= 300 && response.status < 400) {
|
|
526
|
+
const redirected = new URL(location, targetUrl);
|
|
527
|
+
redirected.hash = "";
|
|
528
|
+
if (!sameOrigin(redirected.toString(), devServerUrl)) {
|
|
529
|
+
throw new Error("Proxy redirect left the connected dev server.");
|
|
530
|
+
}
|
|
531
|
+
return fetchPreviewProxyResource(devServerUrl, redirected.toString(), redirects + 1);
|
|
532
|
+
}
|
|
533
|
+
return {
|
|
534
|
+
url: response.url || targetUrl,
|
|
535
|
+
status: response.status,
|
|
536
|
+
headers: response.headers,
|
|
537
|
+
body: Buffer.from(await response.arrayBuffer()),
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
finally {
|
|
541
|
+
clearTimeout(timeout);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function addLiveEditBaseHref(html, href) {
|
|
545
|
+
const escapedHref = href.replace(/&/g, "&").replace(/"/g, """);
|
|
546
|
+
const baseTag = `<base href="${escapedHref}">`;
|
|
547
|
+
if (/<base\b/i.test(html))
|
|
548
|
+
return html;
|
|
549
|
+
if (/<head\b[^>]*>/i.test(html)) {
|
|
550
|
+
return html.replace(/<head\b[^>]*>/i, (match) => `${match}${baseTag}`);
|
|
551
|
+
}
|
|
552
|
+
if (/<html\b[^>]*>/i.test(html)) {
|
|
553
|
+
return html.replace(/<html\b[^>]*>/i, (match) => `${match}<head>${baseTag}</head>`);
|
|
554
|
+
}
|
|
555
|
+
return `<!DOCTYPE html><html><head>${baseTag}<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"></head><body>${html}</body></html>`;
|
|
556
|
+
}
|
|
557
|
+
function injectLiveEditBridge(html, targetUrl, script) {
|
|
558
|
+
const withBase = addLiveEditBaseHref(html, targetUrl);
|
|
559
|
+
if (!script)
|
|
560
|
+
return withBase;
|
|
561
|
+
if (withBase.includes("</body>")) {
|
|
562
|
+
return withBase.replace("</body>", `${script}</body>`);
|
|
563
|
+
}
|
|
564
|
+
if (withBase.includes("</html>")) {
|
|
565
|
+
return withBase.replace("</html>", `${script}</html>`);
|
|
566
|
+
}
|
|
567
|
+
return `${withBase}${script}`;
|
|
568
|
+
}
|
|
472
569
|
/** Read the full request body as a UTF-8 string. */
|
|
473
570
|
async function readRequestBody(req) {
|
|
474
571
|
return new Promise((resolve, reject) => {
|
|
@@ -881,6 +978,7 @@ export async function startDesignConnectBridge(manifest) {
|
|
|
881
978
|
// an unauthenticated caller cannot read it. The server-side grant action
|
|
882
979
|
// obtains it out-of-band (via the exported bridge reference).
|
|
883
980
|
const bridgeToken = crypto.randomBytes(32).toString("hex");
|
|
981
|
+
let liveEditBridgeScript = "";
|
|
884
982
|
const server = http.createServer((req, res) => {
|
|
885
983
|
if (req.method === "OPTIONS") {
|
|
886
984
|
sendJson(res, 204, {});
|
|
@@ -907,6 +1005,78 @@ export async function startDesignConnectBridge(manifest) {
|
|
|
907
1005
|
sendJson(res, 200, { ok: true, source: manifest.source });
|
|
908
1006
|
return;
|
|
909
1007
|
}
|
|
1008
|
+
if (pathname === "/live-edit-bridge") {
|
|
1009
|
+
if (req.method !== "POST") {
|
|
1010
|
+
sendJson(res, 405, { ok: false, error: "method not allowed" });
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
const tokenHeader = req.headers["x-bridge-token"];
|
|
1014
|
+
const providedToken = typeof tokenHeader === "string" ? tokenHeader : "";
|
|
1015
|
+
let tokenValid = false;
|
|
1016
|
+
try {
|
|
1017
|
+
tokenValid =
|
|
1018
|
+
providedToken.length === bridgeToken.length &&
|
|
1019
|
+
crypto.timingSafeEqual(Buffer.from(providedToken, "utf8"), Buffer.from(bridgeToken, "utf8"));
|
|
1020
|
+
}
|
|
1021
|
+
catch {
|
|
1022
|
+
tokenValid = false;
|
|
1023
|
+
}
|
|
1024
|
+
if (!tokenValid) {
|
|
1025
|
+
sendJson(res, 401, {
|
|
1026
|
+
ok: false,
|
|
1027
|
+
error: "invalid or missing bridge token",
|
|
1028
|
+
});
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
void (async () => {
|
|
1032
|
+
try {
|
|
1033
|
+
const raw = await readRequestBody(req);
|
|
1034
|
+
const body = JSON.parse(raw);
|
|
1035
|
+
const script = typeof body["script"] === "string" ? body["script"] : "";
|
|
1036
|
+
if (!script.includes("agent-native:editor-chrome-ready")) {
|
|
1037
|
+
sendJson(res, 400, {
|
|
1038
|
+
ok: false,
|
|
1039
|
+
error: "script must install the Agent Native editor bridge",
|
|
1040
|
+
});
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
liveEditBridgeScript = script;
|
|
1044
|
+
sendJson(res, 200, { ok: true });
|
|
1045
|
+
}
|
|
1046
|
+
catch (err) {
|
|
1047
|
+
sendJson(res, 400, {
|
|
1048
|
+
ok: false,
|
|
1049
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
})();
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
if (pathname === "/live-edit") {
|
|
1056
|
+
if (req.method !== "GET") {
|
|
1057
|
+
sendJson(res, 405, { ok: false, error: "method not allowed" });
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
void (async () => {
|
|
1061
|
+
try {
|
|
1062
|
+
const requestUrl = new URL(req.url ?? "/", manifest.bridgeUrl);
|
|
1063
|
+
const targetUrl = resolvePreviewSnapshotUrl(manifest.devServerUrl, requestUrl.searchParams.get("url") ??
|
|
1064
|
+
requestUrl.searchParams.get("path"));
|
|
1065
|
+
const snapshot = await fetchPreviewSnapshot(manifest.devServerUrl, targetUrl);
|
|
1066
|
+
const html = injectLiveEditBridge(snapshot.html, new URL("/", manifest.bridgeUrl).toString(), liveEditBridgeScript);
|
|
1067
|
+
sendText(res, snapshot.status >= 400 ? snapshot.status : 200, html, snapshot.contentType.includes("html")
|
|
1068
|
+
? snapshot.contentType
|
|
1069
|
+
: "text/html; charset=utf-8");
|
|
1070
|
+
}
|
|
1071
|
+
catch (err) {
|
|
1072
|
+
sendJson(res, 400, {
|
|
1073
|
+
ok: false,
|
|
1074
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
})();
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
910
1080
|
if (pathname === "/snapshot") {
|
|
911
1081
|
if (req.method !== "GET") {
|
|
912
1082
|
sendJson(res, 405, { ok: false, error: "method not allowed" });
|
|
@@ -1148,6 +1318,22 @@ export async function startDesignConnectBridge(manifest) {
|
|
|
1148
1318
|
})();
|
|
1149
1319
|
return;
|
|
1150
1320
|
}
|
|
1321
|
+
if (req.method === "GET" || req.method === "HEAD") {
|
|
1322
|
+
void (async () => {
|
|
1323
|
+
try {
|
|
1324
|
+
const targetUrl = resolvePreviewProxyUrl(manifest.devServerUrl, req.url);
|
|
1325
|
+
const proxied = await fetchPreviewProxyResource(manifest.devServerUrl, targetUrl);
|
|
1326
|
+
sendBytes(res, proxied.status >= 400 ? proxied.status : 200, req.method === "HEAD" ? Buffer.alloc(0) : proxied.body, proxied.headers);
|
|
1327
|
+
}
|
|
1328
|
+
catch (err) {
|
|
1329
|
+
sendJson(res, 400, {
|
|
1330
|
+
ok: false,
|
|
1331
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
})();
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1151
1337
|
sendJson(res, 404, { ok: false, error: "not found" });
|
|
1152
1338
|
});
|
|
1153
1339
|
await new Promise((resolve, reject) => {
|