@agent-native/core 0.123.1 → 0.124.0
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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +20 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/deploy/build.ts +8 -0
- package/corpus/core/src/server/builder-browser.ts +76 -0
- package/corpus/core/src/server/core-routes-plugin.ts +15 -5
- package/corpus/templates/assets/app/global.css +0 -4
- package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +195 -167
- package/corpus/templates/assets/changelog/2026-07-23-drafts-preview-panel-now-fills-the-full-width-with-a-large-p.md +6 -0
- package/corpus/templates/content/actions/_builder-cms-source-adapter.ts +1 -0
- package/corpus/templates/content/actions/_builder-cms-write-client.ts +55 -9
- package/corpus/templates/content/actions/_database-source-utils.ts +756 -182
- package/corpus/templates/content/actions/change-content-database-source-role.ts +21 -20
- package/corpus/templates/content/actions/execute-builder-source-execution.ts +49 -8
- package/corpus/templates/content/actions/materialize-builder-required-fields.ts +42 -9
- package/corpus/templates/content/actions/prepare-builder-source-review.ts +88 -90
- package/corpus/templates/content/actions/preview-builder-source-review.ts +4 -3
- package/corpus/templates/content/actions/refresh-content-database-source.ts +36 -9
- package/corpus/templates/content/actions/set-content-database-source-write-mode.ts +28 -24
- package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +62 -12
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +91 -16
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +15 -1
- package/corpus/templates/content/app/components/editor/SlashCommandMenu.tsx +234 -44
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +194 -16
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +95 -42
- package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +4 -2
- package/corpus/templates/content/app/components/editor/extensions/CodeBlockNode.tsx +10 -166
- package/corpus/templates/content/app/components/editor/extensions/VideoBlock.tsx +32 -8
- package/corpus/templates/content/app/components/editor/extensions/VideoNode.ts +14 -0
- package/corpus/templates/content/app/components/editor/registrySlashItems.ts +5 -1
- package/corpus/templates/content/app/hooks/use-content-database.ts +59 -2
- package/corpus/templates/content/app/hooks/use-documents.ts +18 -26
- package/corpus/templates/content/app/root.tsx +1 -6
- package/corpus/templates/content/changelog/2026-07-24-builder-can-now-publish-approved-updates-to-entries-that-are.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-collection-loading-no-longer-restarts-from-the-begin.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-connections-now-complete-securely-from-netlify-deplo.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-draft-creation-now-scopes-execution-to-the-selected-.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-review-now-distinguishes-preparing-a-safe-dry-run-from.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-source-imports-now-recover-from-a-transient-paginati.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-source-refresh-now-preserves-the-provider-bound-fiel.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-update-reviews-now-open-reliably-on-large-collection.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-write-policy-controls-now-reflect-successful-changes.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-date-properties-now-save-reliably-when-selected-with-the-nat.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-editor-slash-search-now-keeps-multi-word-block-names-open.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-exact-editor-slash-commands-now-execute-on-enter-even-if-the.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-new-collaborative-pages-now-save-their-first-edits.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-new-local-builder-rows-no-longer-remain-locked-behind-a-none.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-opening-or-closing-a-collaborative-document-no-longer-lets-u.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-selected-text-now-opens-the-link-editor-with-command-k-or-co.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-slash-menu-block-choices-no-longer-stall-pointer-interaction.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-uploaded-and-embedded-media-now-stay-intact-while-collaborative-document-drafts-save.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-video-link-insertion-now-keeps-its-source-panel-open-while-t.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-builder-publishing-now-shows-safe-validation-details-instead.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-builder-reviews-stay-responsive-on-large-collections-and-pre.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-collaborative-documents-no-longer-flash-duplicated-recent-bl.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-corrected-builder-updates-are-now-reviewed-separately-from-f.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-documents-now-remain-read-only-until-their-live-collaborativ.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-slash-command-menus-now-stay-reachable-when-editing-near-the.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-the-slash-menu-now-shows-one-clear-callout-choice-instead-of.md +6 -0
- package/corpus/templates/content/shared/api.ts +1 -0
- package/corpus/templates/content/shared/builder-mdx.ts +73 -16
- package/corpus/templates/design/server/handlers/index-design-system-with-builder.ts +38 -21
- package/corpus/templates/slides/server/handlers/index-design-system-with-builder.ts +23 -20
- package/corpus/toolkit/CHANGELOG.md +6 -0
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/editor/useCollabReconcile.ts +14 -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/deploy/build.js +6 -0
- package/dist/deploy/build.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +3 -3
- package/dist/server/builder-browser.d.ts +13 -0
- package/dist/server/builder-browser.d.ts.map +1 -1
- package/dist/server/builder-browser.js +59 -0
- package/dist/server/builder-browser.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +10 -5
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +2 -2
- package/src/deploy/build.ts +8 -0
- package/src/server/builder-browser.ts +76 -0
- package/src/server/core-routes-plugin.ts +15 -5
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
|
|
14
14
|
count: number;
|
|
15
15
|
updated?: undefined;
|
|
16
|
-
error?: undefined;
|
|
17
16
|
ok?: undefined;
|
|
17
|
+
error?: undefined;
|
|
18
18
|
} | {
|
|
19
19
|
count?: undefined;
|
|
20
20
|
updated: number;
|
|
21
|
-
error?: undefined;
|
|
22
21
|
ok?: undefined;
|
|
22
|
+
error?: undefined;
|
|
23
23
|
} | {
|
|
24
24
|
count?: undefined;
|
|
25
25
|
updated?: undefined;
|
|
@@ -28,7 +28,7 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
|
|
|
28
28
|
} | {
|
|
29
29
|
count?: undefined;
|
|
30
30
|
updated?: undefined;
|
|
31
|
-
error?: undefined;
|
|
32
31
|
ok: boolean;
|
|
32
|
+
error?: undefined;
|
|
33
33
|
}>>;
|
|
34
34
|
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -41,16 +41,16 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
-
error?: undefined;
|
|
45
44
|
summary: import("./types.js").TraceSummary;
|
|
46
45
|
spans: import("./types.js").TraceSpan[];
|
|
47
46
|
id?: undefined;
|
|
47
|
+
error?: undefined;
|
|
48
48
|
ok?: undefined;
|
|
49
49
|
} | {
|
|
50
|
-
error?: undefined;
|
|
51
50
|
summary?: undefined;
|
|
52
51
|
spans?: undefined;
|
|
53
52
|
id: string;
|
|
53
|
+
error?: undefined;
|
|
54
54
|
ok?: undefined;
|
|
55
55
|
} | {
|
|
56
56
|
summary?: undefined;
|
|
@@ -59,10 +59,10 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
59
59
|
error: any;
|
|
60
60
|
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
|
-
error?: undefined;
|
|
63
62
|
summary?: undefined;
|
|
64
63
|
spans?: undefined;
|
|
65
64
|
id?: undefined;
|
|
65
|
+
error?: undefined;
|
|
66
66
|
ok: boolean;
|
|
67
67
|
}>>;
|
|
68
68
|
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -37,6 +37,15 @@ export interface BuilderRelayRequestBody {
|
|
|
37
37
|
}
|
|
38
38
|
export declare function isSafeBuilderRelayTargetOrigin(value: string): boolean;
|
|
39
39
|
export declare function isTrustedBuilderRelayTargetOrigin(value: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Netlify's deploy-preview alias is convenient for people but mutable, so it
|
|
42
|
+
* must never be the signed relay destination. The deploy builder embeds
|
|
43
|
+
* Netlify's DEPLOY_ID into the Nitro server bundle, while SITE_NAME remains
|
|
44
|
+
* available to Functions at runtime. Use that pair only when it
|
|
45
|
+
* identifies the same site as the visible preview alias; otherwise preserve
|
|
46
|
+
* the visible origin so callback validation fails closed.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveBuilderPreviewRelayTargetOrigin(previewOrigin: string): string;
|
|
40
49
|
export declare function signBuilderPreviewRelayState(input: {
|
|
41
50
|
ownerEmail: string;
|
|
42
51
|
targetOrigin: string;
|
|
@@ -274,6 +283,10 @@ export declare function getBuilderCallbackEnvVars(params: {
|
|
|
274
283
|
value: string;
|
|
275
284
|
}[];
|
|
276
285
|
export declare function resolveSafePreviewUrl(previewUrl: string | null | undefined, event: H3Event): string;
|
|
286
|
+
export declare function resolveBuilderPreviewRelayParentOrigin(options: {
|
|
287
|
+
openerOrigin?: string | null;
|
|
288
|
+
targetOrigin: string;
|
|
289
|
+
}): string;
|
|
277
290
|
export declare function resolveBuilderCallbackReturnUrl(options: {
|
|
278
291
|
event: H3Event;
|
|
279
292
|
openerOrigin?: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder-browser.d.ts","sourceRoot":"","sources":["../../src/server/builder-browser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAelC,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AACvE,eAAO,MAAM,kBAAkB,iCAAiC,CAAC;AACjE,eAAO,MAAM,yBAAyB,cAAc,CAAC;AACrD,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAC5E,eAAO,MAAM,gCAAgC,8CACA,CAAC;AAC9C,eAAO,MAAM,wCAAwC,sDACA,CAAC;AACtD,eAAO,MAAM,8BAA8B,mCAAmC,CAAC;AAC/E,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,8BAA8B,mCAAmC,CAAC;AAE/E,QAAA,MAAM,qBAAqB,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"builder-browser.d.ts","sourceRoot":"","sources":["../../src/server/builder-browser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAelC,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AACvE,eAAO,MAAM,kBAAkB,iCAAiC,CAAC;AACjE,eAAO,MAAM,yBAAyB,cAAc,CAAC;AACrD,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAC5E,eAAO,MAAM,gCAAgC,8CACA,CAAC;AAC9C,eAAO,MAAM,wCAAwC,sDACA,CAAC;AACtD,eAAO,MAAM,8BAA8B,mCAAmC,CAAC;AAC/E,eAAO,MAAM,yBAAyB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AAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAgDlC"}
|
|
@@ -20,6 +20,8 @@ const BUILDER_RELAY_PURPOSE = "builder-preview-callback-relay";
|
|
|
20
20
|
const BUILDER_RELAY_STATE_VERSION = 1;
|
|
21
21
|
const BUILDER_RELAY_TTL_MS = 10 * 60 * 1000;
|
|
22
22
|
const BUILDER_RELAY_REQUEST_SKEW_MS = 2 * 60 * 1000;
|
|
23
|
+
const IMMUTABLE_NETLIFY_RELAY_HOST = /^(?<deploy>[a-f0-9]{24})--(?<site>[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)\.netlify\.app$/;
|
|
24
|
+
const NETLIFY_DEPLOY_PREVIEW_HOST = /^deploy-preview-\d+--(?<site>[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)\.netlify\.app$/;
|
|
23
25
|
function builderRelaySecret() {
|
|
24
26
|
const secret = process.env[BUILDER_RELAY_SECRET_ENV]?.trim();
|
|
25
27
|
if (!secret) {
|
|
@@ -99,6 +101,38 @@ export function isTrustedBuilderRelayTargetOrigin(value) {
|
|
|
99
101
|
return (exactOriginMatch ||
|
|
100
102
|
builderRelayTargetDomainSuffixes().some((suffix) => hostname.endsWith(suffix)));
|
|
101
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Netlify's deploy-preview alias is convenient for people but mutable, so it
|
|
106
|
+
* must never be the signed relay destination. The deploy builder embeds
|
|
107
|
+
* Netlify's DEPLOY_ID into the Nitro server bundle, while SITE_NAME remains
|
|
108
|
+
* available to Functions at runtime. Use that pair only when it
|
|
109
|
+
* identifies the same site as the visible preview alias; otherwise preserve
|
|
110
|
+
* the visible origin so callback validation fails closed.
|
|
111
|
+
*/
|
|
112
|
+
export function resolveBuilderPreviewRelayTargetOrigin(previewOrigin) {
|
|
113
|
+
let previewUrl;
|
|
114
|
+
try {
|
|
115
|
+
previewUrl = new URL(previewOrigin);
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return previewOrigin;
|
|
119
|
+
}
|
|
120
|
+
const previewMatch = NETLIFY_DEPLOY_PREVIEW_HOST.exec(previewUrl.hostname.toLowerCase());
|
|
121
|
+
if (!previewMatch?.groups?.site)
|
|
122
|
+
return previewOrigin;
|
|
123
|
+
const buildId = process.env.AGENT_NATIVE_BUILD_ID?.trim().toLowerCase();
|
|
124
|
+
const siteName = process.env.SITE_NAME?.trim().toLowerCase();
|
|
125
|
+
if (!buildId ||
|
|
126
|
+
!siteName ||
|
|
127
|
+
!/^[a-f0-9]{24}$/.test(buildId) ||
|
|
128
|
+
siteName !== previewMatch.groups.site) {
|
|
129
|
+
return previewOrigin;
|
|
130
|
+
}
|
|
131
|
+
const immutableOrigin = `https://${buildId}--${siteName}.netlify.app`;
|
|
132
|
+
return IMMUTABLE_NETLIFY_RELAY_HOST.test(new URL(immutableOrigin).hostname)
|
|
133
|
+
? immutableOrigin
|
|
134
|
+
: previewOrigin;
|
|
135
|
+
}
|
|
102
136
|
export function signBuilderPreviewRelayState(input) {
|
|
103
137
|
if (!isSafeBuilderRelayTargetOrigin(input.targetOrigin)) {
|
|
104
138
|
throw new Error("Builder relay target origin is not an approved preview origin.");
|
|
@@ -906,6 +940,31 @@ export function resolveSafePreviewUrl(previewUrl, event) {
|
|
|
906
940
|
}
|
|
907
941
|
return getBuilderBrowserOriginForEvent(event);
|
|
908
942
|
}
|
|
943
|
+
export function resolveBuilderPreviewRelayParentOrigin(options) {
|
|
944
|
+
if (!options.openerOrigin)
|
|
945
|
+
return options.targetOrigin;
|
|
946
|
+
let openerUrl;
|
|
947
|
+
let targetUrl;
|
|
948
|
+
try {
|
|
949
|
+
openerUrl = new URL(options.openerOrigin);
|
|
950
|
+
targetUrl = new URL(options.targetOrigin);
|
|
951
|
+
}
|
|
952
|
+
catch {
|
|
953
|
+
return options.targetOrigin;
|
|
954
|
+
}
|
|
955
|
+
if (openerUrl.origin !== options.openerOrigin ||
|
|
956
|
+
!isSafeBuilderRelayTargetOrigin(openerUrl.origin)) {
|
|
957
|
+
return options.targetOrigin;
|
|
958
|
+
}
|
|
959
|
+
if (openerUrl.origin === targetUrl.origin)
|
|
960
|
+
return openerUrl.origin;
|
|
961
|
+
const openerMatch = NETLIFY_DEPLOY_PREVIEW_HOST.exec(openerUrl.hostname.toLowerCase());
|
|
962
|
+
const targetMatch = IMMUTABLE_NETLIFY_RELAY_HOST.exec(targetUrl.hostname.toLowerCase());
|
|
963
|
+
return openerMatch?.groups?.site &&
|
|
964
|
+
openerMatch.groups.site === targetMatch?.groups?.site
|
|
965
|
+
? openerUrl.origin
|
|
966
|
+
: options.targetOrigin;
|
|
967
|
+
}
|
|
909
968
|
export function resolveBuilderCallbackReturnUrl(options) {
|
|
910
969
|
const openerOrigin = options.openerOrigin && isAllowedBrowserReturnUrl(options.openerOrigin)
|
|
911
970
|
? options.openerOrigin
|