@agent-native/core 0.98.1 → 0.98.2

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 (122) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +8 -0
  3. package/corpus/core/docs/content/locales/ar-SA/pr-visual-recap.mdx +25 -1
  4. package/corpus/core/docs/content/locales/ar-SA/template-plan.mdx +1 -1
  5. package/corpus/core/docs/content/locales/de-DE/pr-visual-recap.mdx +25 -1
  6. package/corpus/core/docs/content/locales/de-DE/template-plan.mdx +1 -1
  7. package/corpus/core/docs/content/locales/es-ES/pr-visual-recap.mdx +25 -1
  8. package/corpus/core/docs/content/locales/es-ES/template-plan.mdx +1 -1
  9. package/corpus/core/docs/content/locales/fr-FR/pr-visual-recap.mdx +25 -1
  10. package/corpus/core/docs/content/locales/fr-FR/template-plan.mdx +1 -1
  11. package/corpus/core/docs/content/locales/hi-IN/pr-visual-recap.mdx +25 -1
  12. package/corpus/core/docs/content/locales/hi-IN/template-plan.mdx +1 -1
  13. package/corpus/core/docs/content/locales/ja-JP/pr-visual-recap.mdx +25 -1
  14. package/corpus/core/docs/content/locales/ja-JP/template-plan.mdx +1 -1
  15. package/corpus/core/docs/content/locales/ko-KR/pr-visual-recap.mdx +25 -1
  16. package/corpus/core/docs/content/locales/ko-KR/template-plan.mdx +1 -1
  17. package/corpus/core/docs/content/locales/pt-BR/pr-visual-recap.mdx +25 -1
  18. package/corpus/core/docs/content/locales/pt-BR/template-plan.mdx +1 -1
  19. package/corpus/core/docs/content/locales/zh-CN/pr-visual-recap.mdx +25 -1
  20. package/corpus/core/docs/content/locales/zh-CN/template-plan.mdx +1 -1
  21. package/corpus/core/docs/content/locales/zh-TW/pr-visual-recap.mdx +25 -1
  22. package/corpus/core/docs/content/locales/zh-TW/template-plan.mdx +1 -1
  23. package/corpus/core/docs/content/pr-visual-recap.mdx +50 -1
  24. package/corpus/core/docs/content/template-plan.mdx +1 -1
  25. package/corpus/core/package.json +1 -1
  26. package/corpus/core/src/cli/plan-local.ts +43 -11
  27. package/corpus/core/src/cli/pr-visual-recap-workflow.ts +2 -9
  28. package/corpus/core/src/cli/recap.ts +356 -4
  29. package/corpus/core/src/cli/skills-content/local-files.ts +17 -12
  30. package/corpus/core/src/client/analytics.ts +96 -14
  31. package/corpus/core/src/client/index.ts +5 -0
  32. package/corpus/core/src/client/session-replay.ts +10 -0
  33. package/corpus/core/src/client/settings/DemoModeSection.tsx +4 -28
  34. package/corpus/core/src/client/url-scrub.ts +13 -0
  35. package/corpus/core/src/client/use-demo-mode-status.ts +44 -0
  36. package/corpus/templates/analytics/AGENTS.md +8 -0
  37. package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +18 -4
  38. package/corpus/templates/analytics/app/lib/demo-chart-trend.ts +156 -0
  39. package/corpus/templates/analytics/changelog/2026-07-12-daily-dashboard-emails-reliably-include-the-complete-dashboa.md +6 -0
  40. package/corpus/templates/analytics/changelog/2026-07-12-demo-mode-charts-trend-upward.md +6 -0
  41. package/corpus/templates/analytics/server/jobs/dashboard-report.ts +2 -0
  42. package/corpus/templates/analytics/server/lib/dashboard-report.ts +17 -33
  43. package/corpus/templates/clips/app/components/player/video-player.tsx +5 -1
  44. package/corpus/templates/clips/changelog/2026-07-11-clips-no-longer-stay-stuck-on-preparing-clip-when-they-are-r.md +6 -0
  45. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +2 -2
  46. package/corpus/templates/content/changelog/2026-07-12-the-left-sidebar-stays-fixed-horizontally-while-scrolling-on.md +6 -0
  47. package/corpus/templates/plan/.agents/skills/visual-plan/references/local-files.md +17 -12
  48. package/corpus/templates/plan/.agents/skills/visual-recap/references/local-files.md +17 -12
  49. package/corpus/templates/plan/actions/validate-local-plan-source.ts +4 -4
  50. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +2 -1
  51. package/corpus/templates/plan/app/lib/plan-local-bridge.ts +41 -0
  52. package/corpus/templates/plan/app/lib/plan-tracking.ts +3 -0
  53. package/corpus/templates/plan/app/pages/PlansPage.tsx +9 -9
  54. package/corpus/templates/plan/app/root.tsx +13 -3
  55. package/corpus/templates/plan/changelog/2026-07-12-local-plan-source-now-stays-on-device.md +6 -0
  56. package/dist/cli/plan-local.d.ts +6 -6
  57. package/dist/cli/plan-local.d.ts.map +1 -1
  58. package/dist/cli/plan-local.js +36 -7
  59. package/dist/cli/plan-local.js.map +1 -1
  60. package/dist/cli/pr-visual-recap-workflow.d.ts +2 -8
  61. package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -1
  62. package/dist/cli/pr-visual-recap-workflow.js +2 -8
  63. package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
  64. package/dist/cli/recap.d.ts +22 -1
  65. package/dist/cli/recap.d.ts.map +1 -1
  66. package/dist/cli/recap.js +286 -2
  67. package/dist/cli/recap.js.map +1 -1
  68. package/dist/cli/skills-content/local-files.d.ts +1 -1
  69. package/dist/cli/skills-content/local-files.d.ts.map +1 -1
  70. package/dist/cli/skills-content/local-files.js +17 -12
  71. package/dist/cli/skills-content/local-files.js.map +1 -1
  72. package/dist/client/analytics.d.ts +8 -0
  73. package/dist/client/analytics.d.ts.map +1 -1
  74. package/dist/client/analytics.js +77 -13
  75. package/dist/client/analytics.js.map +1 -1
  76. package/dist/client/index.d.ts +2 -1
  77. package/dist/client/index.d.ts.map +1 -1
  78. package/dist/client/index.js +2 -1
  79. package/dist/client/index.js.map +1 -1
  80. package/dist/client/session-replay.d.ts +2 -0
  81. package/dist/client/session-replay.d.ts.map +1 -1
  82. package/dist/client/session-replay.js +7 -0
  83. package/dist/client/session-replay.js.map +1 -1
  84. package/dist/client/settings/DemoModeSection.d.ts.map +1 -1
  85. package/dist/client/settings/DemoModeSection.js +4 -23
  86. package/dist/client/settings/DemoModeSection.js.map +1 -1
  87. package/dist/client/url-scrub.d.ts.map +1 -1
  88. package/dist/client/url-scrub.js +14 -0
  89. package/dist/client/url-scrub.js.map +1 -1
  90. package/dist/client/use-demo-mode-status.d.ts +12 -0
  91. package/dist/client/use-demo-mode-status.d.ts.map +1 -0
  92. package/dist/client/use-demo-mode-status.js +30 -0
  93. package/dist/client/use-demo-mode-status.js.map +1 -0
  94. package/dist/collab/struct-routes.d.ts +1 -1
  95. package/dist/notifications/routes.d.ts +3 -3
  96. package/dist/observability/routes.d.ts +5 -5
  97. package/dist/progress/routes.d.ts +1 -1
  98. package/dist/resources/handlers.d.ts +3 -3
  99. package/dist/secrets/routes.d.ts +9 -9
  100. package/docs/content/locales/ar-SA/pr-visual-recap.mdx +25 -1
  101. package/docs/content/locales/ar-SA/template-plan.mdx +1 -1
  102. package/docs/content/locales/de-DE/pr-visual-recap.mdx +25 -1
  103. package/docs/content/locales/de-DE/template-plan.mdx +1 -1
  104. package/docs/content/locales/es-ES/pr-visual-recap.mdx +25 -1
  105. package/docs/content/locales/es-ES/template-plan.mdx +1 -1
  106. package/docs/content/locales/fr-FR/pr-visual-recap.mdx +25 -1
  107. package/docs/content/locales/fr-FR/template-plan.mdx +1 -1
  108. package/docs/content/locales/hi-IN/pr-visual-recap.mdx +25 -1
  109. package/docs/content/locales/hi-IN/template-plan.mdx +1 -1
  110. package/docs/content/locales/ja-JP/pr-visual-recap.mdx +25 -1
  111. package/docs/content/locales/ja-JP/template-plan.mdx +1 -1
  112. package/docs/content/locales/ko-KR/pr-visual-recap.mdx +25 -1
  113. package/docs/content/locales/ko-KR/template-plan.mdx +1 -1
  114. package/docs/content/locales/pt-BR/pr-visual-recap.mdx +25 -1
  115. package/docs/content/locales/pt-BR/template-plan.mdx +1 -1
  116. package/docs/content/locales/zh-CN/pr-visual-recap.mdx +25 -1
  117. package/docs/content/locales/zh-CN/template-plan.mdx +1 -1
  118. package/docs/content/locales/zh-TW/pr-visual-recap.mdx +25 -1
  119. package/docs/content/locales/zh-TW/template-plan.mdx +1 -1
  120. package/docs/content/pr-visual-recap.mdx +50 -1
  121. package/docs/content/template-plan.mdx +1 -1
  122. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- export declare const LOCAL_FILES_REFERENCE_MD = "# Local-files privacy mode \u2014 single source of truth\n\nThis file is the canonical contract for fully local, no-database planning and\nrecaps. It is shared word for word by `/visual-plan` and `/visual-recap`. Read it\nin full before using local-files mode; do not call any hosted Plan tool for a\nlocal plan/recap except the schema-only block-catalog lookup described below.\n\n<!-- SHARED-CORE:local-files START -->\n\n**When to use it.** Use local-files privacy mode when the user explicitly asks\nfor no DB writes, no hosted Plan database writes, no Plan MCP publish, fully local\nfiles, offline/private work, or repo-owned/source-controlled artifacts, or when\n`AGENT_NATIVE_PLANS_MODE=local-files` is set. Also use it when a user or repo\npolicy says the work must stay under their own brand, domain, source control, or\ninfrastructure. In this mode the plan/recap data must never be sent to the Plan\nMCP server or the Plan app action surface. This is the only exception to the\nalways-publish rule in `references/connection.md`.\n\nThe local-files contract:\n\n- **Read context locally.** Read source, diff, and stat context from local files\n and shell commands only. For recaps, the\n `npx @agent-native/core@latest recap collect-diff`, `scan`, and\n `build-prompt --local-files` helpers are safe \u2014 they operate on local files and\n do not write to the Plan database.\n- **Fetch the block catalog first** (it sends no plan content). Use the MCP\n `get-plan-blocks` tool if it is already available, or run\n `npx @agent-native/core@latest plan blocks --out plan-blocks.md` and read that\n file before authoring MDX; it calls the public no-auth `get-plan-blocks` route.\n Use `--format schema` when you need exact nested fields. If network access is\n unavailable, use the bundled `references/*.md` and rely on `plan local check` to\n catch invalid tags. Copy the catalog examples verbatim for the fields the\n registry table cannot encode: `checklist` items need `id` and `label`;\n `question-form` questions need `id`, `title`, and `mode`, and each option needs\n `id` and `label`; and `Code` / `AnnotatedCode` / `Diff` are whitespace-sensitive\n \u2014 encode multiline code as JSON string attributes such as `code={\"const x =\\n y\"}`\n (a static template literal is accepted only when it has no `${...}`\n interpolation). `plan local check` is a quick OFFLINE lint (a subset of the\n renderer schema), so a green `check` does not guarantee the plan renders;\n `plan local verify` is the authoritative validation against the real renderer\n schema.\n- **Write a local MDX folder.** Use `plans/<slug>/` to check the artifact into the\n repo, or a repo-ignored/temporary folder such as `.agent-native/plans/<slug>/`\n or `/tmp/agent-native-plans/<slug>/` when it should not be checked in. The\n folder holds `plan.mdx`, optional `canvas.mdx`, optional `prototype.mdx`, and\n optional `.plan-state.json`. For a recap, set `kind: \"recap\"` and\n `localOnly: true` in the frontmatter/state. Use that exact folder as\n `<plan-dir>` in every command below.\n- **Check, then serve.** Run\n `npx @agent-native/core@latest plan local check --dir <plan-dir>` before any\n preview, then\n `npx @agent-native/core@latest plan local serve --dir <plan-dir> --kind <plan|recap> --open`\n (use `--kind plan` for plans, `--kind recap` for recaps). Report the local\n bridge URL from stdout or `<plan-dir>/.plan-url`; treat `.plan-url` as a local\n token file and do not commit it. The URL opens the hosted Plan UI but reads from\n the localhost bridge on this machine, so it is not shareable across machines. On\n macOS `--open` prefers Chromium browsers; if Safari opens, switch to\n Chrome/Chromium because Safari can block the hosted HTTPS page from fetching the\n HTTP localhost bridge. If the Plan app itself is running locally with the same\n `PLAN_LOCAL_DIR`, the `/local-plans/<slug>` route is also valid. In a truly\n offline environment, hand off the `<plan-dir>` path after `plan local check` and\n note that interactive preview requires network access to the hosted Plan UI or a\n running local Plan app.\n- **Headless verify.** Run\n `npx @agent-native/core@latest plan local verify --dir <plan-dir> --kind <plan|recap>`.\n It starts the bridge, checks the private-network preflight and JSON payload, AND\n validates the content against the real renderer schema via the Plan app's\n `validate-local-plan-source` action. A non-`ok` result with\n `validation.valid: false` lists the renderer's exact schema-path issues (e.g.\n `blocks[1].data.tabs[0]...`); fix those before handing off. If `validation.ran`\n is `false`, the Plan app did not expose the validate endpoint (older/unreachable\n deploy) \u2014 point `--app-url` at a current Plan app (e.g. a local\n `http://localhost:8096`) for the authoritative check. If the browser hangs on\n \"Loading plan\", fetch the `bridgeUrl` from the verify/serve JSON to read the\n concrete validation error.\n- **Never call hosted tools for that plan/recap.** Do not call\n `create-visual-plan`, `create-ui-plan`, `create-prototype-plan`,\n `create-plan-design`, `create-visual-recap`, `create-visual-questions`,\n `import-visual-plan-source`, `update-visual-plan`, `patch-visual-plan-source`,\n `get-plan-feedback`, `export-visual-plan`, `set-resource-visibility`, or any\n other hosted Plan tool \u2014 except the schema-only block-catalog lookup above.\n- **Feedback is file/chat feedback.** Update the MDX files directly, rerun\n `plan local check`, and rerun `serve` or `verify` when that preview path is\n available. Summarize the new local URL when one exists; otherwise summarize the\n checked `<plan-dir>` path. Hosted comments, sharing, screenshots, history, usage\n attachment, and publish/export receipts are unavailable until the user\n explicitly opts into publishing.\n\nLocal-files mode only prevents plan/recap content from reaching the Agent-Native\nPlan database. It does not by itself make the coding agent's language model local;\nfor that stronger boundary the host agent/model must also be local or otherwise\napproved by the user.\n\n<!-- SHARED-CORE:local-files END -->\n";
1
+ export declare const LOCAL_FILES_REFERENCE_MD = "# Local-files privacy mode \u2014 single source of truth\n\nThis file is the canonical contract for fully local, no-database planning and\nrecaps. It is shared word for word by `/visual-plan` and `/visual-recap`. Read it\nin full before using local-files mode; do not call any hosted Plan tool for a\nlocal plan/recap except the schema-only block-catalog lookup described below.\n\n<!-- SHARED-CORE:local-files START -->\n\n**When to use it.** Use local-files privacy mode when the user explicitly asks\nfor no DB writes, no hosted Plan database writes, no Plan MCP publish, fully local\nfiles, offline/private work, or repo-owned/source-controlled artifacts, or when\n`AGENT_NATIVE_PLANS_MODE=local-files` is set. Also use it when a user or repo\npolicy says the work must stay under their own brand, domain, source control, or\ninfrastructure. In this mode the plan/recap data must never be sent to the Plan\nMCP server or the Plan app action surface. This is the only exception to the\nalways-publish rule in `references/connection.md`.\n\nThe local-files contract:\n\n- **Read context locally.** Read source, diff, and stat context from local files\n and shell commands only. For recaps, the\n `npx @agent-native/core@latest recap collect-diff`, `scan`, and\n `build-prompt --local-files` helpers are safe \u2014 they operate on local files and\n do not write to the Plan database.\n- **Fetch the block catalog first** (it sends no plan content). Use the MCP\n `get-plan-blocks` tool if it is already available, or run\n `npx @agent-native/core@latest plan blocks --out plan-blocks.md` and read that\n file before authoring MDX; it calls the public no-auth `get-plan-blocks` route.\n Use `--format schema` when you need exact nested fields. If network access is\n unavailable, use the bundled `references/*.md` and rely on `plan local check` to\n catch invalid tags. Copy the catalog examples verbatim for the fields the\n registry table cannot encode: `checklist` items need `id` and `label`;\n `question-form` questions need `id`, `title`, and `mode`, and each option needs\n `id` and `label`; and `Code` / `AnnotatedCode` / `Diff` are whitespace-sensitive\n \u2014 encode multiline code as JSON string attributes such as `code={\"const x =\\n y\"}`\n (a static template literal is accepted only when it has no `${...}`\n interpolation). `plan local check` is a quick OFFLINE lint (a subset of the\n renderer schema), so a green `check` does not guarantee the plan renders.\n `plan local verify` also stays on-device: it uses the offline lint unless it\n can reach a Plan renderer on an explicit loopback `--app-url`.\n- **Write a local MDX folder.** Use `plans/<slug>/` to check the artifact into the\n repo, or a repo-ignored/temporary folder such as `.agent-native/plans/<slug>/`\n or `/tmp/agent-native-plans/<slug>/` when it should not be checked in. The\n folder holds `plan.mdx`, optional `canvas.mdx`, optional `prototype.mdx`, and\n optional `.plan-state.json`. For a recap, set `kind: \"recap\"` and\n `localOnly: true` in the frontmatter/state. Use that exact folder as\n `<plan-dir>` in every command below.\n- **Check, then serve.** Run\n `npx @agent-native/core@latest plan local check --dir <plan-dir>` before any\n preview, then\n `npx @agent-native/core@latest plan local serve --dir <plan-dir> --kind <plan|recap> --open`\n (use `--kind plan` for plans, `--kind recap` for recaps). Report the local\n bridge URL from stdout or `<plan-dir>/.plan-url`; treat `.plan-url` as a local\n token file and do not commit it. The URL opens the hosted Plan UI but reads from\n the localhost bridge on this machine, so it is not shareable across machines.\n The token is carried in the URL fragment (which is not sent to the hosted\n origin), and the local-plan route disables DOM autocapture and session replay\n while retaining sanitized pageviews and error monitoring. On\n macOS `--open` prefers Chromium browsers; if Safari opens, switch to\n Chrome/Chromium because Safari can block the hosted HTTPS page from fetching the\n HTTP localhost bridge. If the Plan app itself is running locally with the same\n `PLAN_LOCAL_DIR`, the `/local-plans/<slug>` route is also valid. In a truly\n offline environment, hand off the `<plan-dir>` path after `plan local check` and\n note that interactive preview requires network access to the hosted Plan UI or a\n running local Plan app.\n- **Headless verify.** Run\n `npx @agent-native/core@latest plan local verify --dir <plan-dir> --kind <plan|recap>`.\n It starts the bridge and checks the private-network preflight and JSON payload\n entirely on loopback. It never sends MDX or assets to a remote validation\n action. When `--app-url` points to a loopback Plan app, verify also validates\n against that local app's real renderer schema via `validate-local-plan-source`.\n A non-`ok` result with\n `validation.valid: false` lists the renderer's exact schema-path issues (e.g.\n `blocks[1].data.tabs[0]...`); fix those before handing off. If `validation.ran`\n is `false`, verify used the offline lint because the app URL was remote or the\n local Plan app was unavailable. Run a local Plan app and pass\n `--app-url http://localhost:8096` for the authoritative check. If the browser hangs on\n \"Loading plan\", fetch the `bridgeUrl` from the verify/serve JSON to read the\n concrete validation error.\n- **Never call hosted tools for that plan/recap.** Do not call\n `create-visual-plan`, `create-ui-plan`, `create-prototype-plan`,\n `create-plan-design`, `create-visual-recap`, `create-visual-questions`,\n `import-visual-plan-source`, `update-visual-plan`, `patch-visual-plan-source`,\n `get-plan-feedback`, `export-visual-plan`, `set-resource-visibility`, or any\n other hosted Plan tool \u2014 except the schema-only block-catalog lookup above.\n- **Feedback is file/chat feedback.** Update the MDX files directly, rerun\n `plan local check`, and rerun `serve` or `verify` when that preview path is\n available. Summarize the new local URL when one exists; otherwise summarize the\n checked `<plan-dir>` path. Hosted comments, sharing, screenshots, history, usage\n attachment, and publish/export receipts are unavailable until the user\n explicitly opts into publishing.\n\nLocal-files mode prevents plan/recap content from being uploaded to the\nAgent-Native Plan server or database. It does not by itself make the coding agent's language model local;\nfor that stronger boundary the host agent/model must also be local or otherwise\napproved by the user.\n\n<!-- SHARED-CORE:local-files END -->\n";
2
2
  //# sourceMappingURL=local-files.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"local-files.d.ts","sourceRoot":"","sources":["../../../src/cli/skills-content/local-files.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,4kMA8FpC,CAAC"}
1
+ {"version":3,"file":"local-files.d.ts","sourceRoot":"","sources":["../../../src/cli/skills-content/local-files.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,w+MAmGpC,CAAC"}
@@ -36,9 +36,9 @@ The local-files contract:
36
36
  — encode multiline code as JSON string attributes such as \`code={"const x =\\n y"}\`
37
37
  (a static template literal is accepted only when it has no \`\${...}\`
38
38
  interpolation). \`plan local check\` is a quick OFFLINE lint (a subset of the
39
- renderer schema), so a green \`check\` does not guarantee the plan renders;
40
- \`plan local verify\` is the authoritative validation against the real renderer
41
- schema.
39
+ renderer schema), so a green \`check\` does not guarantee the plan renders.
40
+ \`plan local verify\` also stays on-device: it uses the offline lint unless it
41
+ can reach a Plan renderer on an explicit loopback \`--app-url\`.
42
42
  - **Write a local MDX folder.** Use \`plans/<slug>/\` to check the artifact into the
43
43
  repo, or a repo-ignored/temporary folder such as \`.agent-native/plans/<slug>/\`
44
44
  or \`/tmp/agent-native-plans/<slug>/\` when it should not be checked in. The
@@ -53,7 +53,10 @@ The local-files contract:
53
53
  (use \`--kind plan\` for plans, \`--kind recap\` for recaps). Report the local
54
54
  bridge URL from stdout or \`<plan-dir>/.plan-url\`; treat \`.plan-url\` as a local
55
55
  token file and do not commit it. The URL opens the hosted Plan UI but reads from
56
- the localhost bridge on this machine, so it is not shareable across machines. On
56
+ the localhost bridge on this machine, so it is not shareable across machines.
57
+ The token is carried in the URL fragment (which is not sent to the hosted
58
+ origin), and the local-plan route disables DOM autocapture and session replay
59
+ while retaining sanitized pageviews and error monitoring. On
57
60
  macOS \`--open\` prefers Chromium browsers; if Safari opens, switch to
58
61
  Chrome/Chromium because Safari can block the hosted HTTPS page from fetching the
59
62
  HTTP localhost bridge. If the Plan app itself is running locally with the same
@@ -63,14 +66,16 @@ The local-files contract:
63
66
  running local Plan app.
64
67
  - **Headless verify.** Run
65
68
  \`npx @agent-native/core@latest plan local verify --dir <plan-dir> --kind <plan|recap>\`.
66
- It starts the bridge, checks the private-network preflight and JSON payload, AND
67
- validates the content against the real renderer schema via the Plan app's
68
- \`validate-local-plan-source\` action. A non-\`ok\` result with
69
+ It starts the bridge and checks the private-network preflight and JSON payload
70
+ entirely on loopback. It never sends MDX or assets to a remote validation
71
+ action. When \`--app-url\` points to a loopback Plan app, verify also validates
72
+ against that local app's real renderer schema via \`validate-local-plan-source\`.
73
+ A non-\`ok\` result with
69
74
  \`validation.valid: false\` lists the renderer's exact schema-path issues (e.g.
70
75
  \`blocks[1].data.tabs[0]...\`); fix those before handing off. If \`validation.ran\`
71
- is \`false\`, the Plan app did not expose the validate endpoint (older/unreachable
72
- deploy) point \`--app-url\` at a current Plan app (e.g. a local
73
- \`http://localhost:8096\`) for the authoritative check. If the browser hangs on
76
+ is \`false\`, verify used the offline lint because the app URL was remote or the
77
+ local Plan app was unavailable. Run a local Plan app and pass
78
+ \`--app-url http://localhost:8096\` for the authoritative check. If the browser hangs on
74
79
  "Loading plan", fetch the \`bridgeUrl\` from the verify/serve JSON to read the
75
80
  concrete validation error.
76
81
  - **Never call hosted tools for that plan/recap.** Do not call
@@ -86,8 +91,8 @@ The local-files contract:
86
91
  attachment, and publish/export receipts are unavailable until the user
87
92
  explicitly opts into publishing.
88
93
 
89
- Local-files mode only prevents plan/recap content from reaching the Agent-Native
90
- Plan database. It does not by itself make the coding agent's language model local;
94
+ Local-files mode prevents plan/recap content from being uploaded to the
95
+ Agent-Native Plan server or database. It does not by itself make the coding agent's language model local;
91
96
  for that stronger boundary the host agent/model must also be local or otherwise
92
97
  approved by the user.
93
98
 
@@ -1 +1 @@
1
- {"version":3,"file":"local-files.js","sourceRoot":"","sources":["../../../src/cli/skills-content/local-files.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FvC,CAAC","sourcesContent":["export const LOCAL_FILES_REFERENCE_MD = `# Local-files privacy mode — single source of truth\n\nThis file is the canonical contract for fully local, no-database planning and\nrecaps. It is shared word for word by \\`/visual-plan\\` and \\`/visual-recap\\`. Read it\nin full before using local-files mode; do not call any hosted Plan tool for a\nlocal plan/recap except the schema-only block-catalog lookup described below.\n\n<!-- SHARED-CORE:local-files START -->\n\n**When to use it.** Use local-files privacy mode when the user explicitly asks\nfor no DB writes, no hosted Plan database writes, no Plan MCP publish, fully local\nfiles, offline/private work, or repo-owned/source-controlled artifacts, or when\n\\`AGENT_NATIVE_PLANS_MODE=local-files\\` is set. Also use it when a user or repo\npolicy says the work must stay under their own brand, domain, source control, or\ninfrastructure. In this mode the plan/recap data must never be sent to the Plan\nMCP server or the Plan app action surface. This is the only exception to the\nalways-publish rule in \\`references/connection.md\\`.\n\nThe local-files contract:\n\n- **Read context locally.** Read source, diff, and stat context from local files\n and shell commands only. For recaps, the\n \\`npx @agent-native/core@latest recap collect-diff\\`, \\`scan\\`, and\n \\`build-prompt --local-files\\` helpers are safe — they operate on local files and\n do not write to the Plan database.\n- **Fetch the block catalog first** (it sends no plan content). Use the MCP\n \\`get-plan-blocks\\` tool if it is already available, or run\n \\`npx @agent-native/core@latest plan blocks --out plan-blocks.md\\` and read that\n file before authoring MDX; it calls the public no-auth \\`get-plan-blocks\\` route.\n Use \\`--format schema\\` when you need exact nested fields. If network access is\n unavailable, use the bundled \\`references/*.md\\` and rely on \\`plan local check\\` to\n catch invalid tags. Copy the catalog examples verbatim for the fields the\n registry table cannot encode: \\`checklist\\` items need \\`id\\` and \\`label\\`;\n \\`question-form\\` questions need \\`id\\`, \\`title\\`, and \\`mode\\`, and each option needs\n \\`id\\` and \\`label\\`; and \\`Code\\` / \\`AnnotatedCode\\` / \\`Diff\\` are whitespace-sensitive\n — encode multiline code as JSON string attributes such as \\`code={\"const x =\\\\n y\"}\\`\n (a static template literal is accepted only when it has no \\`\\${...}\\`\n interpolation). \\`plan local check\\` is a quick OFFLINE lint (a subset of the\n renderer schema), so a green \\`check\\` does not guarantee the plan renders;\n \\`plan local verify\\` is the authoritative validation against the real renderer\n schema.\n- **Write a local MDX folder.** Use \\`plans/<slug>/\\` to check the artifact into the\n repo, or a repo-ignored/temporary folder such as \\`.agent-native/plans/<slug>/\\`\n or \\`/tmp/agent-native-plans/<slug>/\\` when it should not be checked in. The\n folder holds \\`plan.mdx\\`, optional \\`canvas.mdx\\`, optional \\`prototype.mdx\\`, and\n optional \\`.plan-state.json\\`. For a recap, set \\`kind: \"recap\"\\` and\n \\`localOnly: true\\` in the frontmatter/state. Use that exact folder as\n \\`<plan-dir>\\` in every command below.\n- **Check, then serve.** Run\n \\`npx @agent-native/core@latest plan local check --dir <plan-dir>\\` before any\n preview, then\n \\`npx @agent-native/core@latest plan local serve --dir <plan-dir> --kind <plan|recap> --open\\`\n (use \\`--kind plan\\` for plans, \\`--kind recap\\` for recaps). Report the local\n bridge URL from stdout or \\`<plan-dir>/.plan-url\\`; treat \\`.plan-url\\` as a local\n token file and do not commit it. The URL opens the hosted Plan UI but reads from\n the localhost bridge on this machine, so it is not shareable across machines. On\n macOS \\`--open\\` prefers Chromium browsers; if Safari opens, switch to\n Chrome/Chromium because Safari can block the hosted HTTPS page from fetching the\n HTTP localhost bridge. If the Plan app itself is running locally with the same\n \\`PLAN_LOCAL_DIR\\`, the \\`/local-plans/<slug>\\` route is also valid. In a truly\n offline environment, hand off the \\`<plan-dir>\\` path after \\`plan local check\\` and\n note that interactive preview requires network access to the hosted Plan UI or a\n running local Plan app.\n- **Headless verify.** Run\n \\`npx @agent-native/core@latest plan local verify --dir <plan-dir> --kind <plan|recap>\\`.\n It starts the bridge, checks the private-network preflight and JSON payload, AND\n validates the content against the real renderer schema via the Plan app's\n \\`validate-local-plan-source\\` action. A non-\\`ok\\` result with\n \\`validation.valid: false\\` lists the renderer's exact schema-path issues (e.g.\n \\`blocks[1].data.tabs[0]...\\`); fix those before handing off. If \\`validation.ran\\`\n is \\`false\\`, the Plan app did not expose the validate endpoint (older/unreachable\n deploy) point \\`--app-url\\` at a current Plan app (e.g. a local\n \\`http://localhost:8096\\`) for the authoritative check. If the browser hangs on\n \"Loading plan\", fetch the \\`bridgeUrl\\` from the verify/serve JSON to read the\n concrete validation error.\n- **Never call hosted tools for that plan/recap.** Do not call\n \\`create-visual-plan\\`, \\`create-ui-plan\\`, \\`create-prototype-plan\\`,\n \\`create-plan-design\\`, \\`create-visual-recap\\`, \\`create-visual-questions\\`,\n \\`import-visual-plan-source\\`, \\`update-visual-plan\\`, \\`patch-visual-plan-source\\`,\n \\`get-plan-feedback\\`, \\`export-visual-plan\\`, \\`set-resource-visibility\\`, or any\n other hosted Plan tool — except the schema-only block-catalog lookup above.\n- **Feedback is file/chat feedback.** Update the MDX files directly, rerun\n \\`plan local check\\`, and rerun \\`serve\\` or \\`verify\\` when that preview path is\n available. Summarize the new local URL when one exists; otherwise summarize the\n checked \\`<plan-dir>\\` path. Hosted comments, sharing, screenshots, history, usage\n attachment, and publish/export receipts are unavailable until the user\n explicitly opts into publishing.\n\nLocal-files mode only prevents plan/recap content from reaching the Agent-Native\nPlan database. It does not by itself make the coding agent's language model local;\nfor that stronger boundary the host agent/model must also be local or otherwise\napproved by the user.\n\n<!-- SHARED-CORE:local-files END -->\n`;\n"]}
1
+ {"version":3,"file":"local-files.js","sourceRoot":"","sources":["../../../src/cli/skills-content/local-files.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmGvC,CAAC","sourcesContent":["export const LOCAL_FILES_REFERENCE_MD = `# Local-files privacy mode — single source of truth\n\nThis file is the canonical contract for fully local, no-database planning and\nrecaps. It is shared word for word by \\`/visual-plan\\` and \\`/visual-recap\\`. Read it\nin full before using local-files mode; do not call any hosted Plan tool for a\nlocal plan/recap except the schema-only block-catalog lookup described below.\n\n<!-- SHARED-CORE:local-files START -->\n\n**When to use it.** Use local-files privacy mode when the user explicitly asks\nfor no DB writes, no hosted Plan database writes, no Plan MCP publish, fully local\nfiles, offline/private work, or repo-owned/source-controlled artifacts, or when\n\\`AGENT_NATIVE_PLANS_MODE=local-files\\` is set. Also use it when a user or repo\npolicy says the work must stay under their own brand, domain, source control, or\ninfrastructure. In this mode the plan/recap data must never be sent to the Plan\nMCP server or the Plan app action surface. This is the only exception to the\nalways-publish rule in \\`references/connection.md\\`.\n\nThe local-files contract:\n\n- **Read context locally.** Read source, diff, and stat context from local files\n and shell commands only. For recaps, the\n \\`npx @agent-native/core@latest recap collect-diff\\`, \\`scan\\`, and\n \\`build-prompt --local-files\\` helpers are safe — they operate on local files and\n do not write to the Plan database.\n- **Fetch the block catalog first** (it sends no plan content). Use the MCP\n \\`get-plan-blocks\\` tool if it is already available, or run\n \\`npx @agent-native/core@latest plan blocks --out plan-blocks.md\\` and read that\n file before authoring MDX; it calls the public no-auth \\`get-plan-blocks\\` route.\n Use \\`--format schema\\` when you need exact nested fields. If network access is\n unavailable, use the bundled \\`references/*.md\\` and rely on \\`plan local check\\` to\n catch invalid tags. Copy the catalog examples verbatim for the fields the\n registry table cannot encode: \\`checklist\\` items need \\`id\\` and \\`label\\`;\n \\`question-form\\` questions need \\`id\\`, \\`title\\`, and \\`mode\\`, and each option needs\n \\`id\\` and \\`label\\`; and \\`Code\\` / \\`AnnotatedCode\\` / \\`Diff\\` are whitespace-sensitive\n — encode multiline code as JSON string attributes such as \\`code={\"const x =\\\\n y\"}\\`\n (a static template literal is accepted only when it has no \\`\\${...}\\`\n interpolation). \\`plan local check\\` is a quick OFFLINE lint (a subset of the\n renderer schema), so a green \\`check\\` does not guarantee the plan renders.\n \\`plan local verify\\` also stays on-device: it uses the offline lint unless it\n can reach a Plan renderer on an explicit loopback \\`--app-url\\`.\n- **Write a local MDX folder.** Use \\`plans/<slug>/\\` to check the artifact into the\n repo, or a repo-ignored/temporary folder such as \\`.agent-native/plans/<slug>/\\`\n or \\`/tmp/agent-native-plans/<slug>/\\` when it should not be checked in. The\n folder holds \\`plan.mdx\\`, optional \\`canvas.mdx\\`, optional \\`prototype.mdx\\`, and\n optional \\`.plan-state.json\\`. For a recap, set \\`kind: \"recap\"\\` and\n \\`localOnly: true\\` in the frontmatter/state. Use that exact folder as\n \\`<plan-dir>\\` in every command below.\n- **Check, then serve.** Run\n \\`npx @agent-native/core@latest plan local check --dir <plan-dir>\\` before any\n preview, then\n \\`npx @agent-native/core@latest plan local serve --dir <plan-dir> --kind <plan|recap> --open\\`\n (use \\`--kind plan\\` for plans, \\`--kind recap\\` for recaps). Report the local\n bridge URL from stdout or \\`<plan-dir>/.plan-url\\`; treat \\`.plan-url\\` as a local\n token file and do not commit it. The URL opens the hosted Plan UI but reads from\n the localhost bridge on this machine, so it is not shareable across machines.\n The token is carried in the URL fragment (which is not sent to the hosted\n origin), and the local-plan route disables DOM autocapture and session replay\n while retaining sanitized pageviews and error monitoring. On\n macOS \\`--open\\` prefers Chromium browsers; if Safari opens, switch to\n Chrome/Chromium because Safari can block the hosted HTTPS page from fetching the\n HTTP localhost bridge. If the Plan app itself is running locally with the same\n \\`PLAN_LOCAL_DIR\\`, the \\`/local-plans/<slug>\\` route is also valid. In a truly\n offline environment, hand off the \\`<plan-dir>\\` path after \\`plan local check\\` and\n note that interactive preview requires network access to the hosted Plan UI or a\n running local Plan app.\n- **Headless verify.** Run\n \\`npx @agent-native/core@latest plan local verify --dir <plan-dir> --kind <plan|recap>\\`.\n It starts the bridge and checks the private-network preflight and JSON payload\n entirely on loopback. It never sends MDX or assets to a remote validation\n action. When \\`--app-url\\` points to a loopback Plan app, verify also validates\n against that local app's real renderer schema via \\`validate-local-plan-source\\`.\n A non-\\`ok\\` result with\n \\`validation.valid: false\\` lists the renderer's exact schema-path issues (e.g.\n \\`blocks[1].data.tabs[0]...\\`); fix those before handing off. If \\`validation.ran\\`\n is \\`false\\`, verify used the offline lint because the app URL was remote or the\n local Plan app was unavailable. Run a local Plan app and pass\n \\`--app-url http://localhost:8096\\` for the authoritative check. If the browser hangs on\n \"Loading plan\", fetch the \\`bridgeUrl\\` from the verify/serve JSON to read the\n concrete validation error.\n- **Never call hosted tools for that plan/recap.** Do not call\n \\`create-visual-plan\\`, \\`create-ui-plan\\`, \\`create-prototype-plan\\`,\n \\`create-plan-design\\`, \\`create-visual-recap\\`, \\`create-visual-questions\\`,\n \\`import-visual-plan-source\\`, \\`update-visual-plan\\`, \\`patch-visual-plan-source\\`,\n \\`get-plan-feedback\\`, \\`export-visual-plan\\`, \\`set-resource-visibility\\`, or any\n other hosted Plan tool — except the schema-only block-catalog lookup above.\n- **Feedback is file/chat feedback.** Update the MDX files directly, rerun\n \\`plan local check\\`, and rerun \\`serve\\` or \\`verify\\` when that preview path is\n available. Summarize the new local URL when one exists; otherwise summarize the\n checked \\`<plan-dir>\\` path. Hosted comments, sharing, screenshots, history, usage\n attachment, and publish/export receipts are unavailable until the user\n explicitly opts into publishing.\n\nLocal-files mode prevents plan/recap content from being uploaded to the\nAgent-Native Plan server or database. It does not by itself make the coding agent's language model local;\nfor that stronger boundary the host agent/model must also be local or otherwise\napproved by the user.\n\n<!-- SHARED-CORE:local-files END -->\n`;\n"]}
@@ -42,6 +42,13 @@ export type ConfigureTrackingOptions = {
42
42
  /** First-party analytics track endpoint. */
43
43
  endpoint?: string;
44
44
  getDefaultProps?: GetDefaultProps;
45
+ /**
46
+ * Disable content-capturing analytics such as interaction autocapture and
47
+ * session replay while retaining pageviews, explicit events, and Sentry.
48
+ */
49
+ contentCapture?: boolean;
50
+ /** Resolve content capture synchronously for each browser pathname. */
51
+ contentCaptureForPath?: (pathname: string) => boolean;
45
52
  sessionReplay?: boolean | SessionReplayOptions;
46
53
  /**
47
54
  * First-party, Sentry-style error capture. Auto-captures uncaught errors
@@ -124,6 +131,7 @@ export declare function captureClientException(error: unknown, context?: ClientC
124
131
  */
125
132
  export declare function captureError(error: unknown, context?: ClientCaptureContext): string | undefined;
126
133
  export declare function configureTracking(options: ConfigureTrackingOptions): void;
134
+ export declare function setTrackingContentCaptureEnabled(enabled: boolean): void;
127
135
  export declare function startSessionReplay(options?: SessionReplayOptions): Promise<SessionReplayStartResult>;
128
136
  export declare function maybeStartSessionReplay(options?: SessionReplayOptions): Promise<SessionReplayStartResult>;
129
137
  export declare function stopSessionReplay(reason?: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/client/analytics.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACpB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;QAChC,uBAAuB,CAAC,EAAE;YACxB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;SAC5B,CAAC;KACH;CACF;AAED,KAAK,eAAe,GAAG,CACrB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAO7B;;;;;GAKG;AACH,MAAM,MAAM,yBAAy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CAAC,CAGxE;AAsLD,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI,CASN;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAE1D"}
@@ -25,6 +25,8 @@ let _sessionReplayStartPromise = null;
25
25
  let _errorCaptureInstalled = false;
26
26
  let _errorCaptureDisposer = null;
27
27
  let _sessionReplayModuleForCapture = null;
28
+ let _trackingContentCaptureEnabled = true;
29
+ let _contentCaptureForPath = null;
28
30
  // Buffer for setSentryUser calls made before Sentry has initialized.
29
31
  // `undefined` means "no pending update"; `null` means "pending clear".
30
32
  let _pendingSentryUser = undefined;
@@ -439,7 +441,10 @@ function ensureAmplitude() {
439
441
  ?.VITE_AMPLITUDE_API_KEY;
440
442
  if (!key)
441
443
  return false;
442
- amplitude.init(key, { autocapture: true });
444
+ // Standard pageviews and explicit events are emitted below. Keep SDK-level
445
+ // DOM/network autocapture off so rendered user content is never collected as
446
+ // an implicit analytics side effect.
447
+ amplitude.init(key, { autocapture: false });
443
448
  _amplitudeInitialized = true;
444
449
  return true;
445
450
  }
@@ -710,7 +715,9 @@ export function setSentryUser(user, orgId) {
710
715
  clearTrackingIdentity();
711
716
  }
712
717
  _trackingIdentityResolved = true;
713
- if (shouldRetryReplay && _sessionReplayOptions?.requireSignedInUser) {
718
+ if (shouldRetryReplay &&
719
+ _trackingContentCaptureEnabled &&
720
+ _sessionReplayOptions?.requireSignedInUser) {
714
721
  void startConfiguredSessionReplay(_sessionReplayOptions);
715
722
  }
716
723
  if (_sentryInitialized) {
@@ -795,6 +802,11 @@ export function configureTracking(options) {
795
802
  if (options.getDefaultProps) {
796
803
  _getDefaultProps = options.getDefaultProps;
797
804
  }
805
+ _contentCaptureForPath = options.contentCaptureForPath ?? null;
806
+ _trackingContentCaptureEnabled =
807
+ _contentCaptureForPath && typeof window !== "undefined"
808
+ ? _contentCaptureForPath(window.location.pathname)
809
+ : options.contentCapture !== false;
798
810
  if (typeof window !== "undefined") {
799
811
  ensureSentry();
800
812
  ensureAmplitude();
@@ -805,10 +817,28 @@ export function configureTracking(options) {
805
817
  maybeInstallSessionReplay(options.sessionReplay, {
806
818
  endpoint: options.endpoint,
807
819
  publicKey,
808
- });
820
+ }, _trackingContentCaptureEnabled);
809
821
  maybeInstallErrorCapture(options.errorCapture);
810
822
  }
811
823
  }
824
+ export function setTrackingContentCaptureEnabled(enabled) {
825
+ if (_trackingContentCaptureEnabled === enabled)
826
+ return;
827
+ _trackingContentCaptureEnabled = enabled;
828
+ if (enabled) {
829
+ if (_sessionReplayOptions) {
830
+ void startConfiguredSessionReplay(_sessionReplayOptions);
831
+ }
832
+ }
833
+ else {
834
+ void stopSessionReplay("content-capture-disabled");
835
+ }
836
+ }
837
+ function syncTrackingContentCaptureForLocation() {
838
+ if (!_contentCaptureForPath)
839
+ return;
840
+ setTrackingContentCaptureEnabled(_contentCaptureForPath(window.location.pathname));
841
+ }
812
842
  /**
813
843
  * Lazily load the session-replay module so error capture can read the active
814
844
  * replay id and surface manual captures on the replay timeline without a
@@ -1003,13 +1033,13 @@ function replayEndpointFromTrackingEndpoint(value) {
1003
1033
  }
1004
1034
  return undefined;
1005
1035
  }
1006
- function maybeInstallSessionReplay(config, tracking) {
1036
+ function maybeInstallSessionReplay(config, tracking, start = true) {
1007
1037
  if (typeof window === "undefined")
1008
1038
  return;
1009
1039
  const options = configuredSessionReplayOptions(config, tracking);
1010
- if (!options)
1011
- return;
1012
1040
  _sessionReplayOptions = options;
1041
+ if (!options || !start)
1042
+ return;
1013
1043
  void startConfiguredSessionReplay(options);
1014
1044
  }
1015
1045
  async function waitForSessionReplayAuthIfRequired(options) {
@@ -1034,11 +1064,23 @@ async function startConfiguredSessionReplay(options) {
1034
1064
  if (_sessionReplayStartPromise)
1035
1065
  return _sessionReplayStartPromise;
1036
1066
  _sessionReplayStartPromise = (async () => {
1067
+ if (!_trackingContentCaptureEnabled) {
1068
+ return { started: false, reason: "disabled" };
1069
+ }
1037
1070
  if (!(await waitForSessionReplayAuthIfRequired(options))) {
1038
1071
  return { started: false, reason: "missing-user-id" };
1039
1072
  }
1073
+ if (!_trackingContentCaptureEnabled) {
1074
+ return { started: false, reason: "disabled" };
1075
+ }
1040
1076
  const mod = await import("./session-replay.js");
1041
- return mod.startSessionReplay(options);
1077
+ if (!_trackingContentCaptureEnabled) {
1078
+ return { started: false, reason: "disabled" };
1079
+ }
1080
+ return mod.startSessionReplay({
1081
+ ...options,
1082
+ shouldStart: () => _trackingContentCaptureEnabled && (options.shouldStart?.() ?? true),
1083
+ });
1042
1084
  })()
1043
1085
  .catch(() => ({ started: false, reason: "import-failed" }))
1044
1086
  .finally(() => {
@@ -1047,20 +1089,32 @@ async function startConfiguredSessionReplay(options) {
1047
1089
  return _sessionReplayStartPromise;
1048
1090
  }
1049
1091
  export async function startSessionReplay(options = {}) {
1092
+ if (!_trackingContentCaptureEnabled) {
1093
+ return { started: false, reason: "disabled" };
1094
+ }
1050
1095
  const configured = configuredSessionReplayOptions(options) ?? options;
1051
1096
  if (!(await waitForSessionReplayAuthIfRequired(configured))) {
1052
1097
  return { started: false, reason: "missing-user-id" };
1053
1098
  }
1054
1099
  const mod = await import("./session-replay.js");
1055
- return mod.startSessionReplay(configured);
1100
+ return mod.startSessionReplay({
1101
+ ...configured,
1102
+ shouldStart: () => _trackingContentCaptureEnabled && (configured.shouldStart?.() ?? true),
1103
+ });
1056
1104
  }
1057
1105
  export async function maybeStartSessionReplay(options = {}) {
1106
+ if (!_trackingContentCaptureEnabled) {
1107
+ return { started: false, reason: "disabled" };
1108
+ }
1058
1109
  const configured = configuredSessionReplayOptions(options) ?? options;
1059
1110
  if (!(await waitForSessionReplayAuthIfRequired(configured))) {
1060
1111
  return { started: false, reason: "missing-user-id" };
1061
1112
  }
1062
1113
  const mod = await import("./session-replay.js");
1063
- return mod.maybeStartSessionReplay(configured);
1114
+ return mod.maybeStartSessionReplay({
1115
+ ...configured,
1116
+ shouldStart: () => _trackingContentCaptureEnabled && (configured.shouldStart?.() ?? true),
1117
+ });
1064
1118
  }
1065
1119
  export async function stopSessionReplay(reason = "manual") {
1066
1120
  const mod = await import("./session-replay.js");
@@ -1109,15 +1163,17 @@ function pageviewKey() {
1109
1163
  }
1110
1164
  function pageviewProperties(reason) {
1111
1165
  const properties = {
1112
- url: scrubUrl(window.location.href),
1166
+ url: !_trackingContentCaptureEnabled
1167
+ ? window.location.origin + window.location.pathname
1168
+ : scrubUrl(window.location.href),
1113
1169
  path: window.location.pathname,
1114
1170
  hostname: window.location.hostname,
1115
1171
  navigation_type: reason,
1116
1172
  };
1117
- if (window.location.search) {
1173
+ if (_trackingContentCaptureEnabled && window.location.search) {
1118
1174
  properties.search = scrubUrl(window.location.search);
1119
1175
  }
1120
- if (typeof document !== "undefined") {
1176
+ if (_trackingContentCaptureEnabled && typeof document !== "undefined") {
1121
1177
  if (document.referrer) {
1122
1178
  properties.referrer = scrubUrl(document.referrer);
1123
1179
  }
@@ -1138,6 +1194,9 @@ function emitPageview(reason) {
1138
1194
  trackEvent("pageview", pageviewProperties(reason));
1139
1195
  }
1140
1196
  function schedulePageview(reason) {
1197
+ if (!_trackingContentCaptureEnabled) {
1198
+ void stopSessionReplay("local-plan-privacy");
1199
+ }
1141
1200
  const run = () => emitPageview(reason);
1142
1201
  const pendingStartupContext = [];
1143
1202
  if (_llmConnectionRefresh && !_llmConnectionStatus) {
@@ -1167,15 +1226,20 @@ function installPageviewTracking() {
1167
1226
  const originalReplaceState = window.history.replaceState;
1168
1227
  window.history.pushState = function pushState(...args) {
1169
1228
  const result = originalPushState.apply(this, args);
1229
+ syncTrackingContentCaptureForLocation();
1170
1230
  schedulePageview("pushState");
1171
1231
  return result;
1172
1232
  };
1173
1233
  window.history.replaceState = function replaceState(...args) {
1174
1234
  const result = originalReplaceState.apply(this, args);
1235
+ syncTrackingContentCaptureForLocation();
1175
1236
  schedulePageview("replaceState");
1176
1237
  return result;
1177
1238
  };
1178
- window.addEventListener("popstate", () => schedulePageview("popstate"));
1239
+ window.addEventListener("popstate", () => {
1240
+ syncTrackingContentCaptureForLocation();
1241
+ schedulePageview("popstate");
1242
+ });
1179
1243
  }
1180
1244
  function sendAgentNativeAnalytics(name, properties) {
1181
1245
  if (isLocalAnalyticsHostname(window.location.hostname))