@agent-native/creative-context 0.5.12 → 0.6.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.
@@ -155,84 +155,40 @@ describe("website context connector", () => {
155
155
  ).rejects.toThrow(/SSRF blocked/i);
156
156
  });
157
157
 
158
- it("aborts private-network browser subresources, not only document navigations", async () => {
159
- isBlockedExtensionUrlWithDns.mockImplementation(async (url: string) =>
160
- url.includes("10.0.0.7"),
158
+ it("disables arbitrary Chromium navigation and keeps the static fallback", async () => {
159
+ const staticFetch = vi.fn(async (url: string) =>
160
+ response(
161
+ url,
162
+ "<html><head><title>Public page</title></head><body>Static content</body></html>",
163
+ "text/html",
164
+ ),
161
165
  );
162
- const abort = vi.fn(async () => {});
163
- const continueRoute = vi.fn(async () => {});
164
- let routeHandler: ((route: unknown) => Promise<void>) | undefined;
165
- const page = {
166
- async route(
167
- _pattern: string,
168
- handler: (route: unknown) => Promise<void>,
169
- ) {
170
- routeHandler = handler;
171
- },
172
- async goto() {
173
- await routeHandler?.({
174
- request: () => ({
175
- url: () => "http://10.0.0.7/secret.png",
176
- isNavigationRequest: () => false,
177
- resourceType: () => "image",
178
- }),
179
- abort,
180
- continue: continueRoute,
181
- });
182
- },
183
- async title() {
184
- return "Public page";
185
- },
186
- url() {
187
- return "https://example.com/";
188
- },
189
- locator() {
190
- return { innerText: async () => "Public content" };
191
- },
192
- async setViewportSize() {},
193
- async screenshot() {
194
- return new Uint8Array([1, 2, 3]);
195
- },
196
- async evaluate() {
197
- return {
198
- title: "Public page",
199
- text: "Public content",
200
- assets: [],
201
- internalLinks: [],
202
- designTokens: {
203
- colors: [],
204
- typography: [],
205
- spacing: [],
206
- radii: [],
207
- cssVariables: {},
208
- },
209
- };
210
- },
211
- };
212
- const browser = {
213
- contexts: () => [{ pages: () => [page], newPage: async () => page }],
214
- newContext: async () => ({
215
- pages: () => [page],
216
- newPage: async () => page,
217
- }),
218
- close: async () => {},
219
- };
166
+ const loadPlaywright = vi.fn(async () => {
167
+ throw new Error("Chromium must not be loaded for arbitrary URLs");
168
+ });
220
169
  const renderer = new LayeredRenderedPageProvider({
221
- loadPlaywright: async () =>
222
- ({
223
- chromium: {
224
- connectOverCDP: async () => browser,
225
- launch: async () => browser,
226
- },
227
- }) as never,
170
+ loadPlaywright,
171
+ staticFetch: staticFetch as never,
228
172
  });
229
173
 
230
- await renderer.render({
174
+ const result = await renderer.render({
231
175
  url: "https://example.com/",
232
176
  preferHosted: false,
233
177
  });
234
- expect(abort).toHaveBeenCalledWith("blockedbyclient");
235
- expect(continueRoute).not.toHaveBeenCalled();
178
+
179
+ expect(loadPlaywright).not.toHaveBeenCalled();
180
+ expect(staticFetch).toHaveBeenCalledTimes(1);
181
+ expect(result).toMatchObject({
182
+ method: "static-html",
183
+ rendered: false,
184
+ text: "Public page Static content",
185
+ });
186
+ expect(result.warnings).toEqual(
187
+ expect.arrayContaining([
188
+ expect.stringContaining("connect-time SSRF guard"),
189
+ expect.stringContaining("SSRF-safe static HTML fallback"),
190
+ ]),
191
+ );
236
192
  });
237
193
 
238
194
  it("persists rendered desktop/mobile evidence and extracted design signals privately", async () => {
@@ -145,6 +145,15 @@ export * from "./untrusted-reference.js";
145
145
  export * from "./media.js";
146
146
  export * from "./native-resource-capture.js";
147
147
  export * from "./safe-native-preview.js";
148
+ export {
149
+ brandKitDataFromExtraction,
150
+ buildDesignMarkdown,
151
+ extractRenderedDesignSystemFromUrl,
152
+ styleBriefFromRenderedDesign,
153
+ type ExtractRenderedDesignOptions,
154
+ type RenderedDesignExtraction,
155
+ type RenderedDesignExtractionStatus,
156
+ } from "../connectors/rendered-design.js";
148
157
  export { serializePrivateBlobHandle } from "../connectors/private-artifacts.js";
149
158
  export { resolveNativeContextCloneReference } from "../store/contexts.js";
150
159
  export {