@agent-native/core 0.49.9 → 0.49.11

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.
Files changed (68) hide show
  1. package/dist/cli/pr-visual-recap-workflow.d.ts +1 -1
  2. package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -1
  3. package/dist/cli/pr-visual-recap-workflow.js +1 -1
  4. package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
  5. package/dist/cli/recap.d.ts +4 -1
  6. package/dist/cli/recap.d.ts.map +1 -1
  7. package/dist/cli/recap.js +97 -23
  8. package/dist/cli/recap.js.map +1 -1
  9. package/dist/cli/skills.d.ts +5 -5
  10. package/dist/cli/skills.d.ts.map +1 -1
  11. package/dist/cli/skills.js +219 -24
  12. package/dist/cli/skills.js.map +1 -1
  13. package/dist/client/blocks/library/annotation-rail.d.ts.map +1 -1
  14. package/dist/client/blocks/library/annotation-rail.js +16 -6
  15. package/dist/client/blocks/library/annotation-rail.js.map +1 -1
  16. package/dist/deploy/build.d.ts.map +1 -1
  17. package/dist/deploy/build.js +10 -2
  18. package/dist/deploy/build.js.map +1 -1
  19. package/dist/extensions/actions.js +1 -1
  20. package/dist/extensions/actions.js.map +1 -1
  21. package/dist/local-artifacts/index.d.ts +101 -0
  22. package/dist/local-artifacts/index.d.ts.map +1 -0
  23. package/dist/local-artifacts/index.js +507 -0
  24. package/dist/local-artifacts/index.js.map +1 -0
  25. package/dist/secrets/substitution.js +2 -2
  26. package/dist/secrets/substitution.js.map +1 -1
  27. package/dist/server/auth-marketing.d.ts +1 -0
  28. package/dist/server/auth-marketing.d.ts.map +1 -1
  29. package/dist/server/auth-marketing.js +5 -0
  30. package/dist/server/auth-marketing.js.map +1 -1
  31. package/dist/server/auth.d.ts.map +1 -1
  32. package/dist/server/auth.js +59 -37
  33. package/dist/server/auth.js.map +1 -1
  34. package/dist/server/entry-server.d.ts +27 -4
  35. package/dist/server/entry-server.d.ts.map +1 -1
  36. package/dist/server/entry-server.js +63 -43
  37. package/dist/server/entry-server.js.map +1 -1
  38. package/dist/server/onboarding-html.d.ts.map +1 -1
  39. package/dist/server/onboarding-html.js +3 -3
  40. package/dist/server/onboarding-html.js.map +1 -1
  41. package/dist/server/social-og-image.d.ts +2 -0
  42. package/dist/server/social-og-image.d.ts.map +1 -1
  43. package/dist/server/social-og-image.js +20 -7
  44. package/dist/server/social-og-image.js.map +1 -1
  45. package/dist/server/ssr-handler.d.ts.map +1 -1
  46. package/dist/server/ssr-handler.js +2 -2
  47. package/dist/server/ssr-handler.js.map +1 -1
  48. package/dist/shared/index.d.ts +1 -1
  49. package/dist/shared/index.d.ts.map +1 -1
  50. package/dist/shared/index.js +1 -1
  51. package/dist/shared/index.js.map +1 -1
  52. package/dist/shared/social-meta.d.ts +2 -0
  53. package/dist/shared/social-meta.d.ts.map +1 -1
  54. package/dist/shared/social-meta.js +5 -0
  55. package/dist/shared/social-meta.js.map +1 -1
  56. package/dist/templates/default/.agents/skills/storing-data/SKILL.md +3 -1
  57. package/dist/templates/default/app/entry.server.tsx +8 -2
  58. package/dist/templates/starter-shell-sync.spec.ts +4 -3
  59. package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +3 -2
  60. package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +3 -1
  61. package/docs/content/pr-visual-recap.md +4 -4
  62. package/docs/content/template-content.md +9 -0
  63. package/package.json +6 -1
  64. package/src/templates/default/.agents/skills/storing-data/SKILL.md +3 -1
  65. package/src/templates/default/app/entry.server.tsx +8 -2
  66. package/src/templates/starter-shell-sync.spec.ts +4 -3
  67. package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +3 -2
  68. package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +3 -1
@@ -1,10 +1,19 @@
1
1
  /**
2
2
  * Shared React Router entry-server handler for agent-native templates.
3
3
  *
4
- * Templates that don't need customization can reduce their entry.server.tsx
5
- * to a single re-export:
4
+ * Templates can keep the shared behavior while importing `ServerRouter` from
5
+ * their own app-local `react-router` dependency:
6
6
  *
7
- * export { handleDocumentRequest as default, streamTimeout } from "@agent-native/core/server/entry-server";
7
+ * import { ServerRouter } from "react-router";
8
+ * import { createDocumentRequestHandler, streamTimeout } from "@agent-native/core/server/entry-server";
9
+ *
10
+ * const handleDocumentRequest = createDocumentRequestHandler(ServerRouter);
11
+ * export { streamTimeout };
12
+ * export default handleDocumentRequest;
13
+ *
14
+ * Keeping `ServerRouter` app-local matters in pnpm/published-package installs:
15
+ * React Router's `<Meta />`, `<Links />`, and `<Scripts />` read framework
16
+ * context from the same package singleton that rendered `<ServerRouter>`.
8
17
  *
9
18
  * The superset behavior covers all variants observed across the template fleet:
10
19
  * - HEAD requests: return early with status/headers, no stream body
@@ -17,8 +26,22 @@
17
26
  * conditionally undefined), so the `typeof === "function"` guards that
18
27
  * appeared in older template copies were dead code and are removed here
19
28
  */
29
+ import type { ReactElement } from "react";
20
30
  import type { AppLoadContext, EntryContext } from "react-router";
21
31
  export declare const streamTimeout = 5000;
22
- export declare function handleDocumentRequest(request: Request, responseStatusCode: number, responseHeaders: Headers, routerContext: EntryContext, _loadContext: AppLoadContext): Promise<Response>;
32
+ type ServerRouterComponent = (props: {
33
+ context: EntryContext;
34
+ url: string;
35
+ }) => ReactElement;
36
+ export type DocumentRequestHandler = (request: Request, responseStatusCode: number, responseHeaders: Headers, routerContext: EntryContext, loadContext: AppLoadContext) => Promise<Response>;
37
+ export declare function createDocumentRequestHandler(ServerRouter: ServerRouterComponent): DocumentRequestHandler;
38
+ /**
39
+ * Backwards-compatible default for older generated apps.
40
+ *
41
+ * New templates should call `createDocumentRequestHandler(ServerRouter)` from
42
+ * their own `entry.server.tsx` so React Router framework context always comes
43
+ * from the app-local singleton.
44
+ */
45
+ export declare function handleDocumentRequest(request: Request, responseStatusCode: number, responseHeaders: Headers, routerContext: EntryContext, loadContext: AppLoadContext): Promise<Response>;
23
46
  export default handleDocumentRequest;
24
47
  //# sourceMappingURL=entry-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry-server.d.ts","sourceRoot":"","sources":["../../src/server/entry-server.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AASjE,eAAO,MAAM,aAAa,OAAQ,CAAC;AAEnC,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,OAAO,EACxB,aAAa,EAAE,YAAY,EAC3B,YAAY,EAAE,cAAc,GAC3B,OAAO,CAAC,QAAQ,CAAC,CAoDnB;AAED,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"entry-server.d.ts","sourceRoot":"","sources":["../../src/server/entry-server.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAQjE,eAAO,MAAM,aAAa,OAAQ,CAAC;AAEnC,KAAK,qBAAqB,GAAG,CAAC,KAAK,EAAE;IACnC,OAAO,EAAE,YAAY,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb,KAAK,YAAY,CAAC;AAEnB,MAAM,MAAM,sBAAsB,GAAG,CACnC,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,OAAO,EACxB,aAAa,EAAE,YAAY,EAC3B,WAAW,EAAE,cAAc,KACxB,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,qBAAqB,GAClC,sBAAsB,CA6DxB;AAYD;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,OAAO,EACxB,aAAa,EAAE,YAAY,EAC3B,WAAW,EAAE,cAAc,GAC1B,OAAO,CAAC,QAAQ,CAAC,CASnB;AAED,eAAe,qBAAqB,CAAC"}
@@ -1,54 +1,74 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ServerRouter } from "react-router";
3
2
  import ReactDOMServer from "react-dom/server.browser";
4
3
  const { renderToReadableStream } = ReactDOMServer;
5
4
  import { isbot } from "isbot";
6
5
  import { wrapWithAnalytics } from "./analytics.js";
7
6
  export const streamTimeout = 5_000;
8
- export async function handleDocumentRequest(request, responseStatusCode, responseHeaders, routerContext, _loadContext) {
9
- // HEAD requests need no body return immediately.
10
- if (request.method.toUpperCase() === "HEAD") {
11
- return new Response(null, {
12
- status: responseStatusCode,
13
- headers: responseHeaders,
14
- });
15
- }
16
- // Reject Chrome DevTools well-known probes that have no matching route.
17
- // Content template introduced this improvement; it becomes the default here.
18
- const url = new URL(request.url);
19
- if (url.pathname.startsWith("/.well-known/")) {
20
- return new Response(null, { status: 404 });
21
- }
22
- const userAgent = request.headers.get("user-agent");
23
- // Wait for full render for bots (so crawlers see complete HTML) and in SPA
24
- // mode (where the stream must be fully hydrated before sending).
25
- const waitForAll = (userAgent && isbot(userAgent)) || routerContext.isSpaMode;
26
- const abortController = new AbortController();
27
- const timeoutId = setTimeout(() => abortController.abort(), streamTimeout);
28
- try {
29
- const body = await renderToReadableStream(_jsx(ServerRouter, { context: routerContext, url: request.url }), {
30
- signal: abortController.signal,
31
- onError(error) {
32
- // Only record a 500 when the stream hasn't already been deliberately
33
- // aborted by the timeout above.
34
- if (!abortController.signal.aborted) {
35
- responseStatusCode = 500;
36
- console.error(error);
37
- }
38
- },
39
- });
40
- if (waitForAll) {
41
- await body.allReady;
7
+ export function createDocumentRequestHandler(ServerRouter) {
8
+ return async function handleDocumentRequest(request, responseStatusCode, responseHeaders, routerContext, _loadContext) {
9
+ // HEAD requests need no body — return immediately.
10
+ if (request.method.toUpperCase() === "HEAD") {
11
+ return new Response(null, {
12
+ status: responseStatusCode,
13
+ headers: responseHeaders,
14
+ });
42
15
  }
43
- responseHeaders.set("Content-Type", "text/html");
44
- return new Response(wrapWithAnalytics(body), {
45
- headers: responseHeaders,
46
- status: responseStatusCode,
47
- });
48
- }
49
- finally {
50
- clearTimeout(timeoutId);
16
+ // Reject Chrome DevTools well-known probes that have no matching route.
17
+ // Content template introduced this improvement; it becomes the default here.
18
+ const url = new URL(request.url);
19
+ if (url.pathname.startsWith("/.well-known/")) {
20
+ return new Response(null, { status: 404 });
21
+ }
22
+ const userAgent = request.headers.get("user-agent");
23
+ // Wait for full render for bots (so crawlers see complete HTML) and in SPA
24
+ // mode (where the stream must be fully hydrated before sending).
25
+ const waitForAll = (userAgent && isbot(userAgent)) || routerContext.isSpaMode;
26
+ const abortController = new AbortController();
27
+ const timeoutId = setTimeout(() => abortController.abort(), streamTimeout);
28
+ try {
29
+ const body = await renderToReadableStream(_jsx(ServerRouter, { context: routerContext, url: request.url }), {
30
+ signal: abortController.signal,
31
+ onError(error) {
32
+ // Only record a 500 when the stream hasn't already been deliberately
33
+ // aborted by the timeout above.
34
+ if (!abortController.signal.aborted) {
35
+ responseStatusCode = 500;
36
+ console.error(error);
37
+ }
38
+ },
39
+ });
40
+ if (waitForAll) {
41
+ await body.allReady;
42
+ }
43
+ responseHeaders.set("Content-Type", "text/html");
44
+ return new Response(wrapWithAnalytics(body), {
45
+ headers: responseHeaders,
46
+ status: responseStatusCode,
47
+ });
48
+ }
49
+ finally {
50
+ clearTimeout(timeoutId);
51
+ }
52
+ };
53
+ }
54
+ let defaultDocumentRequestHandler = null;
55
+ async function getDefaultDocumentRequestHandler() {
56
+ if (!defaultDocumentRequestHandler) {
57
+ const { ServerRouter } = await import("react-router");
58
+ defaultDocumentRequestHandler = createDocumentRequestHandler(ServerRouter);
51
59
  }
60
+ return defaultDocumentRequestHandler;
61
+ }
62
+ /**
63
+ * Backwards-compatible default for older generated apps.
64
+ *
65
+ * New templates should call `createDocumentRequestHandler(ServerRouter)` from
66
+ * their own `entry.server.tsx` so React Router framework context always comes
67
+ * from the app-local singleton.
68
+ */
69
+ export async function handleDocumentRequest(request, responseStatusCode, responseHeaders, routerContext, loadContext) {
70
+ const handler = await getDefaultDocumentRequestHandler();
71
+ return handler(request, responseStatusCode, responseHeaders, routerContext, loadContext);
52
72
  }
53
73
  export default handleDocumentRequest;
54
74
  //# sourceMappingURL=entry-server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry-server.js","sourceRoot":"","sources":["../../src/server/entry-server.tsx"],"names":[],"mappings":";AAqBA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,cAAc,MAAM,0BAA0B,CAAC;AAEtD,MAAM,EAAE,sBAAsB,EAAE,GAAG,cAAc,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC;AAEnC,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAgB,EAChB,kBAA0B,EAC1B,eAAwB,EACxB,aAA2B,EAC3B,YAA4B;IAE5B,mDAAmD;IACnD,IAAI,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;QAC5C,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE;YACxB,MAAM,EAAE,kBAAkB;YAC1B,OAAO,EAAE,eAAe;SACzB,CAAC,CAAC;IACL,CAAC;IAED,wEAAwE;IACxE,6EAA6E;IAC7E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QAC7C,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EA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.\n *\n * Templates that don't need customization can reduce their entry.server.tsx\n * to a single re-export:\n *\n * export { handleDocumentRequest as default, streamTimeout } from \"@agent-native/core/server/entry-server\";\n *\n * The superset behavior covers all variants observed across the template fleet:\n * - HEAD requests: return early with status/headers, no stream body\n * - .well-known rejection: 404 before rendering (avoids Chrome DevTools probe noise)\n * - streamTimeout + AbortController: abort render after 5 s, preserving\n * partial output already streamed to the client\n * - bot/allReady detection: wait for full render for bots and SPA mode so\n * crawlers receive complete HTML\n * - wrapWithAnalytics: applied unconditionally — it is a plain import (never\n * conditionally undefined), so the `typeof === \"function\"` guards that\n * appeared in older template copies were dead code and are removed here\n */\n\nimport type { AppLoadContext, EntryContext } from \"react-router\";\nimport { ServerRouter } from \"react-router\";\nimport ReactDOMServer from \"react-dom/server.browser\";\n\nconst { renderToReadableStream } = ReactDOMServer;\n\nimport { isbot } from \"isbot\";\nimport { wrapWithAnalytics } from \"./analytics.js\";\n\nexport const streamTimeout = 5_000;\n\nexport async function handleDocumentRequest(\n request: Request,\n responseStatusCode: number,\n responseHeaders: Headers,\n routerContext: EntryContext,\n _loadContext: AppLoadContext,\n): Promise<Response> {\n // HEAD requests need no body — return immediately.\n if (request.method.toUpperCase() === \"HEAD\") {\n return new Response(null, {\n status: responseStatusCode,\n headers: responseHeaders,\n });\n }\n\n // Reject Chrome DevTools well-known probes that have no matching route.\n // Content template introduced this improvement; it becomes the default here.\n const url = new URL(request.url);\n if (url.pathname.startsWith(\"/.well-known/\")) {\n return new Response(null, { status: 404 });\n }\n\n const userAgent = request.headers.get(\"user-agent\");\n // Wait for full render for bots (so crawlers see complete HTML) and in SPA\n // mode (where the stream must be fully hydrated before sending).\n const waitForAll = (userAgent && isbot(userAgent)) || routerContext.isSpaMode;\n\n const abortController = new AbortController();\n const timeoutId = setTimeout(() => abortController.abort(), streamTimeout);\n\n try {\n const body = await renderToReadableStream(\n <ServerRouter context={routerContext} url={request.url} />,\n {\n signal: abortController.signal,\n onError(error: unknown) {\n // Only record a 500 when the stream hasn't already been deliberately\n // aborted by the timeout above.\n if (!abortController.signal.aborted) {\n responseStatusCode = 500;\n console.error(error);\n }\n },\n },\n );\n\n if (waitForAll) {\n await body.allReady;\n }\n\n responseHeaders.set(\"Content-Type\", \"text/html\");\n return new Response(wrapWithAnalytics(body), {\n headers: responseHeaders,\n status: responseStatusCode,\n });\n } finally {\n clearTimeout(timeoutId);\n }\n}\n\nexport default handleDocumentRequest;\n"]}
1
+ {"version":3,"file":"entry-server.js","sourceRoot":"","sources":["../../src/server/entry-server.tsx"],"names":[],"mappings":";AA+BA,OAAO,cAAc,MAAM,0BAA0B,CAAC;AAEtD,MAAM,EAAE,sBAAsB,EAAE,GAAG,cAAc,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC;AAenC,MAAM,UAAU,4BAA4B,CAC1C,YAAmC;IAEnC,OAAO,KAAK,UAAU,qBAAqB,CACzC,OAAgB,EAChB,kBAA0B,EAC1B,eAAwB,EACxB,aAA2B,EAC3B,YAA4B;QAE5B,mDAAmD;QACnD,IAAI,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;YAC5C,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE;gBACxB,MAAM,EAAE,kBAAkB;gBAC1B,OAAO,EAAE,eAAe;aACzB,CAAC,CAAC;QACL,CAAC;QAED,wEAAwE;QACxE,6EAA6E;QAC7E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YAC7C,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7C,CAAC;QA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C,IAAI,CAAC,6BAA6B,EAAE,CAAC;QACnC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;QACtD,6BAA6B,GAAG,4BAA4B,CAAC,YAAY,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAgB,EAChB,kBAA0B,EAC1B,eAAwB,EACxB,aAA2B,EAC3B,WAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,gCAAgC,EAAE,CAAC;IACzD,OAAO,OAAO,CACZ,OAAO,EACP,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,WAAW,CACZ,CAAC;AACJ,CAAC;AAED,eAAe,qBAAqB,CAAC","sourcesContent":["/**\n * Shared React Router entry-server handler for agent-native templates.\n *\n * Templates can keep the shared behavior while importing `ServerRouter` from\n * their own app-local `react-router` dependency:\n *\n * import { ServerRouter } from \"react-router\";\n * import { createDocumentRequestHandler, streamTimeout } from \"@agent-native/core/server/entry-server\";\n *\n * const handleDocumentRequest = createDocumentRequestHandler(ServerRouter);\n * export { streamTimeout };\n * export default handleDocumentRequest;\n *\n * Keeping `ServerRouter` app-local matters in pnpm/published-package installs:\n * React Router's `<Meta />`, `<Links />`, and `<Scripts />` read framework\n * context from the same package singleton that rendered `<ServerRouter>`.\n *\n * The superset behavior covers all variants observed across the template fleet:\n * - HEAD requests: return early with status/headers, no stream body\n * - .well-known rejection: 404 before rendering (avoids Chrome DevTools probe noise)\n * - streamTimeout + AbortController: abort render after 5 s, preserving\n * partial output already streamed to the client\n * - bot/allReady detection: wait for full render for bots and SPA mode so\n * crawlers receive complete HTML\n * - wrapWithAnalytics: applied unconditionally — it is a plain import (never\n * conditionally undefined), so the `typeof === \"function\"` guards that\n * appeared in older template copies were dead code and are removed here\n */\n\nimport type { ReactElement } from \"react\";\nimport type { AppLoadContext, EntryContext } from \"react-router\";\nimport ReactDOMServer from \"react-dom/server.browser\";\n\nconst { renderToReadableStream } = ReactDOMServer;\n\nimport { isbot } from \"isbot\";\nimport { wrapWithAnalytics } from \"./analytics.js\";\n\nexport const streamTimeout = 5_000;\n\ntype ServerRouterComponent = (props: {\n context: EntryContext;\n url: string;\n}) => ReactElement;\n\nexport type DocumentRequestHandler = (\n request: Request,\n responseStatusCode: number,\n responseHeaders: Headers,\n routerContext: EntryContext,\n loadContext: AppLoadContext,\n) => Promise<Response>;\n\nexport function createDocumentRequestHandler(\n ServerRouter: ServerRouterComponent,\n): DocumentRequestHandler {\n return async function handleDocumentRequest(\n request: Request,\n responseStatusCode: number,\n responseHeaders: Headers,\n routerContext: EntryContext,\n _loadContext: AppLoadContext,\n ): Promise<Response> {\n // HEAD requests need no body — return immediately.\n if (request.method.toUpperCase() === \"HEAD\") {\n return new Response(null, {\n status: responseStatusCode,\n headers: responseHeaders,\n });\n }\n\n // Reject Chrome DevTools well-known probes that have no matching route.\n // Content template introduced this improvement; it becomes the default here.\n const url = new URL(request.url);\n if (url.pathname.startsWith(\"/.well-known/\")) {\n return new Response(null, { status: 404 });\n }\n\n const userAgent = request.headers.get(\"user-agent\");\n // Wait for full render for bots (so crawlers see complete HTML) and in SPA\n // mode (where the stream must be fully hydrated before sending).\n const waitForAll =\n (userAgent && isbot(userAgent)) || routerContext.isSpaMode;\n\n const abortController = new AbortController();\n const timeoutId = setTimeout(() => abortController.abort(), streamTimeout);\n\n try {\n const body = await renderToReadableStream(\n <ServerRouter context={routerContext} url={request.url} />,\n {\n signal: abortController.signal,\n onError(error: unknown) {\n // Only record a 500 when the stream hasn't already been deliberately\n // aborted by the timeout above.\n if (!abortController.signal.aborted) {\n responseStatusCode = 500;\n console.error(error);\n }\n },\n },\n );\n\n if (waitForAll) {\n await body.allReady;\n }\n\n responseHeaders.set(\"Content-Type\", \"text/html\");\n return new Response(wrapWithAnalytics(body), {\n headers: responseHeaders,\n status: responseStatusCode,\n });\n } finally {\n clearTimeout(timeoutId);\n }\n };\n}\n\nlet defaultDocumentRequestHandler: DocumentRequestHandler | null = null;\n\nasync function getDefaultDocumentRequestHandler(): Promise<DocumentRequestHandler> {\n if (!defaultDocumentRequestHandler) {\n const { ServerRouter } = await import(\"react-router\");\n defaultDocumentRequestHandler = createDocumentRequestHandler(ServerRouter);\n }\n return defaultDocumentRequestHandler;\n}\n\n/**\n * Backwards-compatible default for older generated apps.\n *\n * New templates should call `createDocumentRequestHandler(ServerRouter)` from\n * their own `entry.server.tsx` so React Router framework context always comes\n * from the app-local singleton.\n */\nexport async function handleDocumentRequest(\n request: Request,\n responseStatusCode: number,\n responseHeaders: Headers,\n routerContext: EntryContext,\n loadContext: AppLoadContext,\n): Promise<Response> {\n const handler = await getDefaultDocumentRequestHandler();\n return handler(\n request,\n responseStatusCode,\n responseHeaders,\n routerContext,\n loadContext,\n );\n}\n\nexport default handleDocumentRequest;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"onboarding-html.d.ts","sourceRoot":"","sources":["../../src/server/onboarding-html.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AA0C/B,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,qBAA0B,GAAG,MAAM,CAk7D1E;AAED,kDAAkD;AAClD,eAAO,MAAM,eAAe,QAAsB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CA0G7C"}
1
+ {"version":3,"file":"onboarding-html.d.ts","sourceRoot":"","sources":["../../src/server/onboarding-html.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AA2C/B,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,qBAA0B,GAAG,MAAM,CAo7D1E;AAED,kDAAkD;AAClD,eAAO,MAAM,eAAe,QAAsB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CA0G7C"}
@@ -12,7 +12,7 @@ import { getWorkspaceGatewayReturnOrigin } from "./oauth-return-url.js";
12
12
  import { identitySsoLoginButtonHtml } from "./identity-sso-store.js";
13
13
  import { resolveBuiltInAuthMarketing, } from "./auth-marketing.js";
14
14
  import { AUTH_REDIRECT_QUERY_PARAM } from "../shared/auth-redirect-url.js";
15
- import { AGENT_NATIVE_SOCIAL_IMAGE_ALT, AGENT_NATIVE_SOCIAL_IMAGE_HEIGHT, AGENT_NATIVE_SOCIAL_IMAGE_PATH, AGENT_NATIVE_SOCIAL_IMAGE_TYPE, AGENT_NATIVE_SOCIAL_IMAGE_WIDTH, } from "../shared/social-meta.js";
15
+ import { AGENT_NATIVE_SOCIAL_IMAGE_ALT, AGENT_NATIVE_SOCIAL_IMAGE_HEIGHT, AGENT_NATIVE_SOCIAL_IMAGE_PATH, AGENT_NATIVE_SOCIAL_IMAGE_TYPE, AGENT_NATIVE_SOCIAL_IMAGE_WIDTH, withAgentNativeSocialImageCacheBuster, } from "../shared/social-meta.js";
16
16
  import { normalizeAppBasePath } from "./app-base-path.js";
17
17
  function hasGoogleOAuth() {
18
18
  return !!(process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET);
@@ -62,9 +62,9 @@ export function getOnboardingHtml(opts = {}) {
62
62
  const hasMarketing = !!marketing;
63
63
  const runLocalCommand = marketing?.runLocalCommand?.trim();
64
64
  const brandMarkSrc = withAppBasePath("/agent-native-icon-dark.svg");
65
- const socialImageUrl = opts.requestOrigin
65
+ const socialImageUrl = withAgentNativeSocialImageCacheBuster(opts.requestOrigin
66
66
  ? `${opts.requestOrigin}${withAppBasePath(AGENT_NATIVE_SOCIAL_IMAGE_PATH)}`
67
- : withAppBasePath(AGENT_NATIVE_SOCIAL_IMAGE_PATH);
67
+ : withAppBasePath(AGENT_NATIVE_SOCIAL_IMAGE_PATH));
68
68
  const esc = (s) => s
69
69
  .replace(/&/g, "&amp;")
70
70
  .replace(/</g, "&lt;")