@posthog/wizard 2.80.1 → 2.81.1

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 (134) hide show
  1. package/README.md +19 -17
  2. package/dist/README.md +6 -4
  3. package/dist/{agent-interface-CemBvTAA.js → agent-interface-DMP3DZRd.js} +184 -25
  4. package/dist/agent-interface-DMP3DZRd.js.map +1 -0
  5. package/dist/{agent-prompt-loader-DPnj6SwU.js → agent-prompt-loader-BrivWIna.js} +6 -6
  6. package/dist/{agent-prompt-loader-DPnj6SwU.js.map → agent-prompt-loader-BrivWIna.js.map} +1 -1
  7. package/dist/{analytics-D21z3E5l.js → analytics-X7JfAmh6.js} +6 -3
  8. package/dist/analytics-X7JfAmh6.js.map +1 -0
  9. package/dist/analytics-dcL9EQ4r.js +2 -0
  10. package/dist/{api-DtGIqQ2U.js → api-BkDwZoL4.js} +3 -2
  11. package/dist/{api-DtGIqQ2U.js.map → api-BkDwZoL4.js.map} +1 -1
  12. package/dist/api-BrMGAI-b.js +2 -0
  13. package/dist/api-key-login-CZEgx2jb.js +2 -0
  14. package/dist/{api-key-login-h3E2G3zu.js → api-key-login-DE0yKkP4.js} +5 -5
  15. package/dist/{api-key-login-h3E2G3zu.js.map → api-key-login-DE0yKkP4.js.map} +1 -1
  16. package/dist/bin.js +2 -2
  17. package/dist/{bounded-fs-CAsuF6al.js → bounded-fs-iDiqDQ9v.js} +3 -3
  18. package/dist/{bounded-fs-CAsuF6al.js.map → bounded-fs-iDiqDQ9v.js.map} +1 -1
  19. package/dist/{ci-install-CEYE02t-.js → ci-install-BAftKh2Z.js} +7 -7
  20. package/dist/{ci-install-CEYE02t-.js.map → ci-install-BAftKh2Z.js.map} +1 -1
  21. package/dist/{console-log-O828zyiq.js → console-log-DJiTqYT2.js} +3 -3
  22. package/dist/{console-log-O828zyiq.js.map → console-log-DJiTqYT2.js.map} +1 -1
  23. package/dist/{debug-BfQPD2Hg.js → debug-C3tLP-ZW.js} +3 -3
  24. package/dist/{debug-BfQPD2Hg.js.map → debug-C3tLP-ZW.js.map} +1 -1
  25. package/dist/{emit-RfAewcWv.js → emit-BqLCdV8Y.js} +2 -1
  26. package/dist/{emit-RfAewcWv.js.map → emit-BqLCdV8Y.js.map} +1 -1
  27. package/dist/{errors-CHrJzAZb.js → errors-DhFeR8Sp.js} +3 -3
  28. package/dist/{errors-CHrJzAZb.js.map → errors-DhFeR8Sp.js.map} +1 -1
  29. package/dist/{gateway-D3gIlR6b.js → gateway-IQjQ582o.js} +7 -7
  30. package/dist/{gateway-D3gIlR6b.js.map → gateway-IQjQ582o.js.map} +1 -1
  31. package/dist/{headless-BJjhP0SI.js → headless-DOhxEmw5.js} +2 -2
  32. package/dist/{headless-BJjhP0SI.js.map → headless-DOhxEmw5.js.map} +1 -1
  33. package/dist/{headless-DIX68UUA.js → headless-XNvdWVEp.js} +1 -1
  34. package/dist/{host-resolution-D8GhEVoX.js → host-resolution-DI2oucSK.js} +4 -4
  35. package/dist/{host-resolution-D8GhEVoX.js.map → host-resolution-DI2oucSK.js.map} +1 -1
  36. package/dist/{install-paPCzPHI.js → install-BixbBDLR.js} +41 -55
  37. package/dist/install-BixbBDLR.js.map +1 -0
  38. package/dist/{install-Bw8tvDvS.js → install-DaZ6pvEl.js} +1 -1
  39. package/dist/{interactive-tdxZKWax.js → interactive-WLNQWF0D.js} +3 -3
  40. package/dist/{interactive-tdxZKWax.js.map → interactive-WLNQWF0D.js.map} +1 -1
  41. package/dist/{links-Cyj6v8kg.js → links-Bye4fsrj.js} +3 -3
  42. package/dist/{links-Cyj6v8kg.js.map → links-Bye4fsrj.js.map} +1 -1
  43. package/dist/{main-0p-YxUNa.js → main-CN8nbuZO.js} +25 -25
  44. package/dist/main-CN8nbuZO.js.map +1 -0
  45. package/dist/{mcp-D3Z5MXhA.js → mcp-B2o4d9DS.js} +3 -3
  46. package/dist/{mcp-D3Z5MXhA.js.map → mcp-B2o4d9DS.js.map} +1 -1
  47. package/dist/{mcp-prompt-streaming-COVbWnHt.js → mcp-prompt-streaming-COs1DfAm.js} +5 -5
  48. package/dist/{mcp-prompt-streaming-COVbWnHt.js.map → mcp-prompt-streaming-COs1DfAm.js.map} +1 -1
  49. package/dist/{models-D1SnCzvl.js → models-Cow22jET.js} +2 -2
  50. package/dist/{models-D1SnCzvl.js.map → models-Cow22jET.js.map} +1 -1
  51. package/dist/{non-interactive-DxRBc73O.js → non-interactive-DkldwWDM.js} +4 -4
  52. package/dist/{non-interactive-DxRBc73O.js.map → non-interactive-DkldwWDM.js.map} +1 -1
  53. package/dist/{oauth-session-Dde79Ycm.js → oauth-session-Bj_-BY7o.js} +2 -2
  54. package/dist/{oauth-session-Dde79Ycm.js.map → oauth-session-Bj_-BY7o.js.map} +1 -1
  55. package/dist/{orchestrator-tools-BSNhzzkT.js → orchestrator-tools-lhFIBGnp.js} +3 -3
  56. package/dist/{orchestrator-tools-BSNhzzkT.js.map → orchestrator-tools-lhFIBGnp.js.map} +1 -1
  57. package/dist/{package-manager-BRXlXo0p.js → package-manager-DZ4wcTz3.js} +4 -4
  58. package/dist/{package-manager-BRXlXo0p.js.map → package-manager-DZ4wcTz3.js.map} +1 -1
  59. package/dist/{pi-cM_4Gd_9.js → pi-DREdQRPP.js} +15 -15
  60. package/dist/{pi-cM_4Gd_9.js.map → pi-DREdQRPP.js.map} +1 -1
  61. package/dist/{playground-DTKy0XHT.js → playground-CJx3lwTH.js} +4 -4
  62. package/dist/{playground-DTKy0XHT.js.map → playground-CJx3lwTH.js.map} +1 -1
  63. package/dist/{posthog-integration-bwHwE87a.js → posthog-integration-DDSPdbpw.js} +63 -50
  64. package/dist/posthog-integration-DDSPdbpw.js.map +1 -0
  65. package/dist/{programs-SeT1qNik.js → programs-6SFfUBmm.js} +88 -34
  66. package/dist/programs-6SFfUBmm.js.map +1 -0
  67. package/dist/programs-DvlhdeM_.js +3 -0
  68. package/dist/provisioning-CPGWgv7p.js +2 -0
  69. package/dist/{provisioning-JbJtq7hq.js → provisioning-tRDPH7EQ.js} +4 -4
  70. package/dist/{provisioning-JbJtq7hq.js.map → provisioning-tRDPH7EQ.js.map} +1 -1
  71. package/dist/{queue-tools-BIZSJyt6.js → queue-tools-DrJKvFHZ.js} +4 -4
  72. package/dist/{queue-tools-BIZSJyt6.js.map → queue-tools-DrJKvFHZ.js.map} +1 -1
  73. package/dist/{results-DtKICAdz.js → results-Crcubw0Q.js} +37 -2
  74. package/dist/results-Crcubw0Q.js.map +1 -0
  75. package/dist/{run-DDCvLILJ.js → run-BrIGaPy7.js} +10 -10
  76. package/dist/run-BrIGaPy7.js.map +1 -0
  77. package/dist/{run-CDurA5tO.js → run-DVFTMbxf.js} +31 -15
  78. package/dist/run-DVFTMbxf.js.map +1 -0
  79. package/dist/{run-tool-DML8JJvt.js → run-tool-CxdPXmlY.js} +37 -21
  80. package/dist/{run-tool-DML8JJvt.js.map → run-tool-CxdPXmlY.js.map} +1 -1
  81. package/dist/run-tool-GfISLgEs.js +2 -0
  82. package/dist/{runners-Dhu4pZTN.js → runners-loOOmHyc.js} +37 -19
  83. package/dist/runners-loOOmHyc.js.map +1 -0
  84. package/dist/{security-DEH8Rn0_.js → security-C_grSgIM.js} +44 -52
  85. package/dist/security-C_grSgIM.js.map +1 -0
  86. package/dist/{setup-utils-C5-WM-hS.js → setup-utils-BYXbb9NM.js} +3 -3
  87. package/dist/{setup-utils-C5-WM-hS.js.map → setup-utils-BYXbb9NM.js.map} +1 -1
  88. package/dist/{start-playground-DL4mVEUx.js → start-playground-Blh0Swil.js} +13 -12
  89. package/dist/{start-playground-DL4mVEUx.js.map → start-playground-Blh0Swil.js.map} +1 -1
  90. package/dist/{subagent-CnFvAq6E.js → subagent-DQ_enM8C.js} +7 -7
  91. package/dist/subagent-DQ_enM8C.js.map +1 -0
  92. package/dist/{task-BOScSm4W.js → task-Dm9wZbVW.js} +18 -17
  93. package/dist/task-Dm9wZbVW.js.map +1 -0
  94. package/dist/{telemetry-CP4rGicd.js → telemetry-NeZhrBeW.js} +2 -2
  95. package/dist/{telemetry-CP4rGicd.js.map → telemetry-NeZhrBeW.js.map} +1 -1
  96. package/dist/{terminal-J3OD3dN0.js → terminal-Z4hCXfie.js} +186 -134
  97. package/dist/terminal-Z4hCXfie.js.map +1 -0
  98. package/dist/{tools-Cz8tDptL.js → tools-1aM6bI9Y.js} +8 -8
  99. package/dist/{tools-Cz8tDptL.js.map → tools-1aM6bI9Y.js.map} +1 -1
  100. package/dist/{tools-CCMV3DmB.js → tools-dUJHRo6X.js} +15 -15
  101. package/dist/{tools-CCMV3DmB.js.map → tools-dUJHRo6X.js.map} +1 -1
  102. package/dist/{tui-BUZ2PWqN.js → tui-CCO7VVTA.js} +1 -1
  103. package/dist/{tui-Csf7VJxt.js → tui-Cmi_ckGg.js} +4 -4
  104. package/dist/{tui-Csf7VJxt.js.map → tui-Cmi_ckGg.js.map} +1 -1
  105. package/dist/{upload-step-CEacB2RV.js → upload-step-e2Jp2fcr.js} +3 -3
  106. package/dist/{upload-step-CEacB2RV.js.map → upload-step-e2Jp2fcr.js.map} +1 -1
  107. package/dist/{urls-BDELGZHq.js → urls-Cu4RO30x.js} +2 -2
  108. package/dist/{urls-BDELGZHq.js.map → urls-Cu4RO30x.js.map} +1 -1
  109. package/dist/{wizard-abort-D3-75KyV.js → wizard-abort-BPEiPCXk.js} +5 -5
  110. package/dist/{wizard-abort-D3-75KyV.js.map → wizard-abort-BPEiPCXk.js.map} +1 -1
  111. package/dist/{yara-hooks-CZ1tKxy_.js → yara-hooks-CFD60h78.js} +1 -1
  112. package/dist/{yara-hooks-D8YDyX7o.js → yara-hooks-canFIYTc.js} +4 -4
  113. package/dist/{yara-hooks-D8YDyX7o.js.map → yara-hooks-canFIYTc.js.map} +1 -1
  114. package/package.json +2 -1
  115. package/dist/agent-interface-CemBvTAA.js.map +0 -1
  116. package/dist/analytics-B3ROGuIr.js +0 -2
  117. package/dist/analytics-D21z3E5l.js.map +0 -1
  118. package/dist/api-IhROOQNv.js +0 -2
  119. package/dist/api-key-login-OEntFvu5.js +0 -2
  120. package/dist/install-paPCzPHI.js.map +0 -1
  121. package/dist/main-0p-YxUNa.js.map +0 -1
  122. package/dist/posthog-integration-bwHwE87a.js.map +0 -1
  123. package/dist/programs-BhtyA3lE.js +0 -3
  124. package/dist/programs-SeT1qNik.js.map +0 -1
  125. package/dist/provisioning-BcXfeCMc.js +0 -2
  126. package/dist/results-DtKICAdz.js.map +0 -1
  127. package/dist/run-CDurA5tO.js.map +0 -1
  128. package/dist/run-DDCvLILJ.js.map +0 -1
  129. package/dist/run-tool-CTq9OOdT.js +0 -2
  130. package/dist/runners-Dhu4pZTN.js.map +0 -1
  131. package/dist/security-DEH8Rn0_.js.map +0 -1
  132. package/dist/subagent-CnFvAq6E.js.map +0 -1
  133. package/dist/task-BOScSm4W.js.map +0 -1
  134. package/dist/terminal-J3OD3dN0.js.map +0 -1
@@ -1,19 +1,23 @@
1
- import { d as relativeToInstallDir, i as getLogFilePath, o as logToFile } from "./debug-BfQPD2Hg.js";
2
- import { A as POSTHOG_APP_URL, B as REPLAY_VISION_SUPPORTED, D as Integration, E as ISSUES_URL, F as POSTHOG_PRIVACY_URL, J as WIZARD_OAUTH_SCOPES, M as POSTHOG_DOCS_URL, O as OAUTH_PORTS, P as POSTHOG_ORG_AI_SETTINGS_URL, Q as WIZARD_PROVISIONING_SCOPES, R as POSTHOG_TERMS_URL, V as SETUP_REPORT_FILE, i as sessionProperties, k as OAUTH_TIMEOUT_MS, m as DUMMY_PROJECT_API_KEY, n as analytics, nt as WIZARD_USER_AGENT, rt as getSkillsBaseUrl } from "./analytics-D21z3E5l.js";
3
- import { A as getProvisioningScopesForProgram, B as SOURCE_MAPS_CONTEXT_KEYS, C as oauthErrorFromTokenBody, D as getCommandPath, E as findProgramConfig, F as detectErrorTrackingProjects, G as detectSelfDrivingIntegrationProjects, H as NO_DEFAULT_LIMIT, J as POSTHOG_PRESENT_KEY, K as GITHUB_REQUIRED_BODY, L as detectSourceMapsProjects, O as getOAuthScopesForProgram, P as ERROR_TRACKING_PROJECT_PATH_KEY, R as DISPLAY_NAME, S as oauthErrorFromCallbackParams, T as Program, U as PRICING_LONG, W as PRICING_SHORT, Y as SELF_DRIVING_INTEGRATE_PATH_KEY, _ as missingOAuthScopes, b as buildCallbackErrorHtml, c as buildSession, d as SessionStore, et as getAuditChecks, f as applyAgentProgress, g as getOAuthClientId, h as OAuthTokenResponseSchema, it as getBlockingServiceKeys, j as getSubcommandPrograms, k as getProgramConfig, nt as SIGNUP_WIZARD_READINESS_CONFIG, q as GITHUB_REQUIRED_MESSAGE, rt as evaluateWizardReadiness, tt as SERVICE_LABELS, v as parseOAuthScopes, x as buildOAuthFailureMessage, y as OAuthError, z as MANUAL_SDK_VARIANTS } from "./programs-SeT1qNik.js";
4
- import { r as withUtm, t as openTrackedLink } from "./links-Cyj6v8kg.js";
5
- import { t as withProgress } from "./telemetry-CP4rGicd.js";
6
- import { t as detectOrgAndProject } from "./setup-utils-C5-WM-hS.js";
7
- import { a as getOAuthUrl, i as getIntegrationAuthorizeUrl, s as resolveBaseUrl } from "./urls-BDELGZHq.js";
8
- import { t as HostResolution } from "./host-resolution-D8GhEVoX.js";
9
- import { A as computeTokenCostUsd, D as streamMcpPrompt, M as formatTokenCount, i as withScopeAdditions, j as formatCostUsd, l as POSTHOG_SDKS, m as getDetectedWarehouseSources, r as CONNECT_SLACK_SCOPE_ADDITIONS, u as STRIPE_SDKS, w as FRAMEWORK_REGISTRY } from "./posthog-integration-bwHwE87a.js";
10
- import { y as fetchSkillMenu } from "./yara-hooks-D8YDyX7o.js";
11
- import { n as isOk, o as summarizeFailure, r as namesWithStatus } from "./results-DtKICAdz.js";
12
- import { f as getKindMeta, l as MCP_TUTORIAL_SCOPE_ADDITIONS, n as getTool, p as fetchHealthIssues, t as Tool } from "./tools-CCMV3DmB.js";
13
- import { a as fetchGithubConnected, c as fetchUserData, n as ApiError, o as fetchProjectData, s as fetchSlackConnected } from "./api-DtGIqQ2U.js";
1
+ import { n as ErrorCodes } from "./emit-BqLCdV8Y.js";
2
+ import { d as relativeToInstallDir, i as getLogFilePath, o as logToFile } from "./debug-C3tLP-ZW.js";
3
+ import { A as POSTHOG_APP_URL, B as REPLAY_VISION_SUPPORTED, D as Integration, E as ISSUES_URL, F as POSTHOG_PRIVACY_URL, J as WIZARD_OAUTH_SCOPES, M as POSTHOG_DOCS_URL, O as OAUTH_PORTS, P as POSTHOG_ORG_AI_SETTINGS_URL, Q as WIZARD_PROVISIONING_SCOPES, R as POSTHOG_TERMS_URL, V as SETUP_REPORT_FILE, i as sessionProperties, k as OAUTH_TIMEOUT_MS, m as DUMMY_PROJECT_API_KEY, n as analytics, nt as WIZARD_USER_AGENT, rt as getSkillsBaseUrl } from "./analytics-X7JfAmh6.js";
4
+ import { A as getProvisioningScopesForProgram, B as SOURCE_MAPS_CONTEXT_KEYS, C as oauthErrorFromTokenBody, D as getCommandPath, E as findProgramConfig, F as detectErrorTrackingProjects, G as detectSelfDrivingIntegrationProjects, H as NO_DEFAULT_LIMIT, J as POSTHOG_PRESENT_KEY, K as GITHUB_REQUIRED_BODY, L as detectSourceMapsProjects, O as getOAuthScopesForProgram, P as ERROR_TRACKING_PROJECT_PATH_KEY, R as DISPLAY_NAME, S as oauthErrorFromCallbackParams, T as Program, U as PRICING_LONG, W as PRICING_SHORT, Y as SELF_DRIVING_INTEGRATE_PATH_KEY, _ as missingOAuthScopes, at as evaluateWizardReadiness, b as buildCallbackErrorHtml, c as buildSession, d as SessionStore, et as CONNECT_SLACK_SCOPE_ADDITIONS, f as applyAgentProgress, g as getOAuthClientId, h as OAuthTokenResponseSchema, it as SIGNUP_WIZARD_READINESS_CONFIG, j as getSubcommandPrograms, k as getProgramConfig, nt as getAuditChecks, ot as getBlockingServiceKeys, q as GITHUB_REQUIRED_MESSAGE, rt as SERVICE_LABELS, tt as withScopeAdditions, v as parseOAuthScopes, x as buildOAuthFailureMessage, y as OAuthError, z as MANUAL_SDK_VARIANTS } from "./programs-6SFfUBmm.js";
5
+ import "./errors-DhFeR8Sp.js";
6
+ import { r as withUtm, t as openTrackedLink } from "./links-Bye4fsrj.js";
7
+ import { t as withProgress } from "./telemetry-NeZhrBeW.js";
8
+ import { t as detectOrgAndProject } from "./setup-utils-BYXbb9NM.js";
9
+ import { r as currentCredentials } from "./oauth-session-Bj_-BY7o.js";
10
+ import { g as isGrantRevoked } from "./agent-interface-DMP3DZRd.js";
11
+ import { a as getOAuthUrl, i as getIntegrationAuthorizeUrl, s as resolveBaseUrl } from "./urls-Cu4RO30x.js";
12
+ import { t as HostResolution } from "./host-resolution-DI2oucSK.js";
13
+ import { A as formatCostUsd, C as FRAMEWORK_REGISTRY, E as streamMcpPrompt, c as POSTHOG_SDKS, j as formatTokenCount, k as computeTokenCostUsd, l as STRIPE_SDKS, p as getDetectedWarehouseSources } from "./posthog-integration-DDSPdbpw.js";
14
+ import { y as fetchSkillMenu } from "./yara-hooks-canFIYTc.js";
15
+ import { n as namesWithStatus, o as summarizeFailure, t as isOk } from "./results-Crcubw0Q.js";
16
+ import { f as getKindMeta, l as MCP_TUTORIAL_SCOPE_ADDITIONS, n as getTool, p as fetchHealthIssues } from "./tools-dUJHRo6X.js";
17
+ import { a as fetchGithubConnected, c as fetchUserData, n as ApiError, o as fetchProjectData, s as fetchSlackConnected } from "./api-BkDwZoL4.js";
14
18
  import { n as AVAILABLE_FEATURES, o as isAllFeaturesSelected, t as ALL_FEATURE_VALUES } from "./defaults-DDVl3tKN.js";
15
- import { n as provisionNewAccount, r as requestDeepLink, t as ProvisionedAccountUnreadableError } from "./provisioning-JbJtq7hq.js";
16
- import { r as wizardAbort } from "./wizard-abort-D3-75KyV.js";
19
+ import { n as provisionNewAccount, r as requestDeepLink, t as ProvisionedAccountUnreadableError } from "./provisioning-tRDPH7EQ.js";
20
+ import { r as wizardAbort } from "./wizard-abort-BPEiPCXk.js";
17
21
  import { a as useStdoutDimensions, c as wrapAndTruncate, d as isObjectBlock, f as ConfirmButton, h as Icons, i as useKeyboardHintsContext, l as isClearBlock, m as Colors, n as useKeyBindings, o as computeVisibleRange, p as PromptLabel, r as KeyboardHintsProvider, s as wordWrap, t as PickerMenu, u as isLinesBlock } from "./PickerMenu-BGGeYqd-.js";
18
22
  import * as fs$1 from "fs";
19
23
  import path from "path";
@@ -6541,12 +6545,6 @@ const POSTHOG_INTEGRATION_FLOW = [
6541
6545
  screenId: "mcp",
6542
6546
  isComplete: (tui) => tui.mcpComplete
6543
6547
  },
6544
- {
6545
- id: "slack-connect",
6546
- label: "Connect Slack",
6547
- screenId: "slack-connect",
6548
- isComplete: (tui) => tui.slackStepDismissed
6549
- },
6550
6548
  {
6551
6549
  id: "keep-skills",
6552
6550
  label: "Keep Skills",
@@ -7056,7 +7054,7 @@ const FrameworkPicker = ({ store, onComplete }) => {
7056
7054
  })),
7057
7055
  onSelect: (value) => {
7058
7056
  const integration = Array.isArray(value) ? value[0] : value;
7059
- import("./programs-BhtyA3lE.js").then(({ FRAMEWORK_REGISTRY }) => {
7057
+ import("./programs-DvlhdeM_.js").then(({ FRAMEWORK_REGISTRY }) => {
7060
7058
  const config = FRAMEWORK_REGISTRY[integration];
7061
7059
  store.setFrameworkConfig(integration, config);
7062
7060
  store.setDetectedFramework(config.metadata.name);
@@ -8831,17 +8829,37 @@ const SelfDrivingHandoffScreen = ({ store }) => {
8831
8829
  * Installing the App is a manual browser step, so polling is what flips the
8832
8830
  * gate once the user comes back. The first tick also resolves the session's
8833
8831
  * unknown (`null`) state.
8832
+ *
8833
+ * Each tick reads the token through the login's OAuth session, since the gate
8834
+ * can open, or sit, past the token's 1-hour life. A stale token 401s every
8835
+ * tick, and the gate then asks for an install the project already has.
8834
8836
  */
8835
8837
  const POLL_INTERVAL_MS$1 = 3e3;
8836
8838
  async function fetchLoginUrl(session) {
8837
8839
  if (!session.signup || !session.credentials) return null;
8838
8840
  return await requestDeepLink(session.credentials.accessToken, session.credentials.host) ?? `${session.credentials.host.appHost}/login`;
8839
8841
  }
8842
+ const isUnauthorized = (err) => axios.isAxiosError(err) && err.response?.status === 401;
8843
+ /** One check. A 401 rotates the token once and retries before it counts as a failure. */
8844
+ async function checkGithubConnected(store, signal) {
8845
+ const held = store.session.credentials;
8846
+ if (!held) return false;
8847
+ const check = (credentials) => fetchGithubConnected(credentials.accessToken, credentials.projectId, credentials.host.apiHost, signal);
8848
+ const credentials = await currentCredentials(held);
8849
+ try {
8850
+ return await check(credentials);
8851
+ } catch (err) {
8852
+ if (!isUnauthorized(err) || !credentials.refreshToken || isGrantRevoked()) throw err;
8853
+ const rotated = await currentCredentials(credentials, true);
8854
+ if (rotated.accessToken === credentials.accessToken) throw err;
8855
+ return check(rotated);
8856
+ }
8857
+ }
8840
8858
  function useGithubConnection(store) {
8841
- const credentials = store.session.credentials;
8859
+ const loggedIn = store.session.credentials !== null;
8842
8860
  const connected = store.githubConnected === true;
8843
8861
  useEffect(() => {
8844
- if (!credentials || connected) return;
8862
+ if (!loggedIn || connected) return;
8845
8863
  const controller = new AbortController();
8846
8864
  let stopped = false;
8847
8865
  let timer;
@@ -8856,7 +8874,7 @@ function useGithubConnection(store) {
8856
8874
  (async () => {
8857
8875
  while (!stopped) {
8858
8876
  try {
8859
- const isConnected = await fetchGithubConnected(credentials.accessToken, credentials.projectId, credentials.host.apiHost, controller.signal);
8877
+ const isConnected = await checkGithubConnected(store, controller.signal);
8860
8878
  if (stopped) return;
8861
8879
  if (isConnected) {
8862
8880
  if (store.githubConnected === false) analytics.wizardCapture("github connect completed");
@@ -8881,7 +8899,7 @@ function useGithubConnection(store) {
8881
8899
  controller.abort();
8882
8900
  };
8883
8901
  }, [
8884
- credentials,
8902
+ loggedIn,
8885
8903
  connected,
8886
8904
  store
8887
8905
  ]);
@@ -9657,14 +9675,20 @@ const TUI_TOOLS$3 = { "posthog-doctor": {
9657
9675
  * importing business logic directly. Testable, no dynamic imports.
9658
9676
  *
9659
9677
  * Supports two modes via the `mode` prop:
9660
- * - 'install': detect clients → confirm → [pick clients] → pick features → install
9678
+ * - 'install': detect clients → pick clients (esc cancels) → pick features → install
9661
9679
  * - 'remove': detect installed clients → confirm → remove
9662
9680
  *
9663
- * When done, calls store.setMcpComplete(). The router resolves to outro.
9681
+ * A successful install ends on one screen: results, any login commands, sample
9682
+ * prompts and the tutorial command. When done, calls store.setMcpComplete().
9664
9683
  */
9665
9684
  const markDone = (store, outcome, clients = [], featuresSelected, loginCommands = []) => {
9666
9685
  store.setMcpComplete(outcome, clients, featuresSelected, loginCommands);
9667
9686
  };
9687
+ /** Report the outcome as the results show, and complete the step on Enter. */
9688
+ const doneOnEnter = (store, outcome, clients = [], featuresSelected, loginCommands = []) => {
9689
+ store.reportMcpOutcome(outcome, clients, featuresSelected);
9690
+ return () => markDone(store, outcome, clients, featuresSelected, loginCommands);
9691
+ };
9668
9692
  /**
9669
9693
  * The editor-owned login commands still to run after this install: fresh
9670
9694
  * config entries use the client's own server name, plugin-provided servers
@@ -9747,7 +9771,7 @@ const DoneContinue = ({ onContinue }) => {
9747
9771
  })
9748
9772
  });
9749
9773
  };
9750
- const McpScreen = ({ store, installer, mode = "install" }) => {
9774
+ const McpScreen = ({ store, installer, mode = "install", samplePrompts = [] }) => {
9751
9775
  useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
9752
9776
  useInput(() => void 0);
9753
9777
  const isRemove = mode === "remove";
@@ -9758,6 +9782,7 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
9758
9782
  const [pluginResults, setPluginResults] = useState([]);
9759
9783
  const [detectError, setDetectError] = useState(null);
9760
9784
  const [flowError, setFlowError] = useState(null);
9785
+ const [loginCommands, setLoginCommands] = useState([]);
9761
9786
  const finishFlow = useRef(null);
9762
9787
  useEffect(() => {
9763
9788
  (async () => {
@@ -9768,11 +9793,11 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
9768
9793
  setTimeout(() => markDone(store, "no_clients"), 1500);
9769
9794
  } else {
9770
9795
  setClients(detected);
9771
- setPhase("ask");
9796
+ setPhase(isRemove ? "ask" : "pick");
9772
9797
  }
9773
9798
  } catch (err) {
9774
9799
  setDetectError(errorText(err));
9775
- finishFlow.current = () => markDone(store, "failed");
9800
+ finishFlow.current = doneOnEnter(store, "failed");
9776
9801
  setPhase("none");
9777
9802
  }
9778
9803
  })();
@@ -9794,14 +9819,15 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
9794
9819
  }
9795
9820
  setPhase("feature-select");
9796
9821
  };
9797
- const handleConfirm = () => {
9798
- if (isRemove) doRemove();
9799
- else if (clients.length === 1) proceedAfterClientPick([clients[0].name]);
9800
- else setPhase("pick");
9801
- };
9802
9822
  const handleSkip = () => {
9803
9823
  markDone(store, "skipped");
9804
9824
  };
9825
+ useKeyBindings("mcp-skip", phase === "pick" ? [{
9826
+ match: "escape",
9827
+ label: "esc",
9828
+ action: "cancel",
9829
+ handler: handleSkip
9830
+ }] : []);
9805
9831
  const doInstall = async (names, features) => {
9806
9832
  setPhase("working");
9807
9833
  let mcpResult = [];
@@ -9826,7 +9852,8 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
9826
9852
  const outcome = ready.length > 0 ? "installed" : "failed";
9827
9853
  const featuresReport = reportFeatures(features ?? [...ALL_FEATURE_VALUES]);
9828
9854
  const logins = oauthFlow ? pendingLoginCommands(clients, mcpResult, pluginResult) : [];
9829
- finishFlow.current = () => markDone(store, outcome, ready.map((r) => r.name), featuresReport, logins);
9855
+ setLoginCommands(logins);
9856
+ finishFlow.current = doneOnEnter(store, outcome, ready.map((r) => r.name), featuresReport, logins);
9830
9857
  setPhase("done");
9831
9858
  };
9832
9859
  const doRemove = async () => {
@@ -9839,15 +9866,10 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
9839
9866
  }
9840
9867
  setMcpResults(result);
9841
9868
  const removed = result.filter(isOk);
9842
- const outcome = removed.length > 0 ? "installed" : "failed";
9843
- finishFlow.current = () => markDone(store, outcome, removed.map((r) => r.name));
9869
+ finishFlow.current = doneOnEnter(store, removed.length > 0 ? "installed" : "failed", removed.map((r) => r.name));
9844
9870
  setPhase("done");
9845
9871
  };
9846
- const installValueBullets = [
9847
- "Ask your agent: \"List my feature flags\" — and it does.",
9848
- "Run SQL, build dashboards, ship flags, all from your IDE.",
9849
- "No copy-pasting tokens or context. Your agent has the keys."
9850
- ];
9872
+ const installValueLines = ["Ask your agent: \"List my feature flags\" — and it does.", "Run SQL, build dashboards, ship flags, all from your IDE."];
9851
9873
  const okMcpNames = mcpResults.filter(isOk).map((r) => r.name);
9852
9874
  const finishNotes = clients.flatMap((c) => c.finish && okMcpNames.includes(c.name) ? [{
9853
9875
  name: c.name,
@@ -9861,13 +9883,14 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
9861
9883
  const pluginAlreadyInstalled = namesWithStatus(pluginResults, "unchanged");
9862
9884
  const failures = [...mcpResults, ...pluginResults].filter((r) => r.status === "failed").map((r) => r.detail ? `${r.name} — ${r.detail}` : r.name);
9863
9885
  const hasAnyResult = installedNow.length + alreadyInstalled.length + pluginInstalled.length + pluginAlreadyInstalled.length + failures.length + finishNotes.length > 0;
9886
+ const installSucceeded = !isRemove && [...mcpResults, ...pluginResults].some(isOk);
9864
9887
  return /* @__PURE__ */ jsxs(Box, {
9865
9888
  flexDirection: "column",
9866
9889
  flexGrow: 1,
9867
9890
  children: [/* @__PURE__ */ jsx(Text, {
9868
9891
  bold: true,
9869
9892
  color: Colors.accent,
9870
- children: isRemove ? "Remove the PostHog MCP" : "Install the MCP so you can chat to your data"
9893
+ children: isRemove ? "Remove the PostHog MCP" : phase === "done" && installSucceeded ? "You're all set — chat to your data from your client" : "Install the MCP so you can chat to your data"
9871
9894
  }), /* @__PURE__ */ jsxs(Box, {
9872
9895
  marginTop: 1,
9873
9896
  flexDirection: "column",
@@ -9902,36 +9925,28 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
9902
9925
  " MCP clients detected. Skipping..."
9903
9926
  ]
9904
9927
  })),
9905
- phase === "ask" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
9906
- !isRemove && /* @__PURE__ */ jsx(Box, {
9907
- flexDirection: "column",
9908
- marginBottom: 1,
9909
- children: installValueBullets.map((bullet) => /* @__PURE__ */ jsxs(Text, {
9910
- dimColor: true,
9911
- children: [
9912
- "•",
9913
- " ",
9914
- bullet
9915
- ]
9916
- }, bullet))
9917
- }),
9918
- /* @__PURE__ */ jsxs(Text, {
9919
- dimColor: true,
9920
- children: ["Detected: ", clients.map((c) => c.name).join(", ")]
9921
- }),
9922
- /* @__PURE__ */ jsx(Box, {
9923
- marginTop: 1,
9924
- children: /* @__PURE__ */ jsx(ConfirmationInput, {
9925
- message: `${isRemove ? "Remove" : "Install"} the PostHog MCP server${clients.some((c) => c.supportsPlugin) ? " and plugin" : ""}?`,
9926
- confirmLabel: isRemove ? "Remove" : "Install",
9927
- cancelLabel: "No thanks",
9928
- onConfirm: handleConfirm,
9929
- onCancel: handleSkip
9930
- })
9928
+ phase === "ask" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Text, {
9929
+ dimColor: true,
9930
+ children: ["Detected: ", clients.map((c) => c.name).join(", ")]
9931
+ }), /* @__PURE__ */ jsx(Box, {
9932
+ marginTop: 1,
9933
+ children: /* @__PURE__ */ jsx(ConfirmationInput, {
9934
+ message: `Remove the PostHog MCP server${clients.some((c) => c.supportsPlugin) ? " and plugin" : ""}?`,
9935
+ confirmLabel: "Remove",
9936
+ cancelLabel: "No thanks",
9937
+ onConfirm: () => void doRemove(),
9938
+ onCancel: handleSkip
9931
9939
  })
9932
- ] }),
9933
- phase === "pick" && /* @__PURE__ */ jsx(PickerMenu, {
9934
- message: "Select editor to install",
9940
+ })] }),
9941
+ phase === "pick" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Box, {
9942
+ flexDirection: "column",
9943
+ marginBottom: 1,
9944
+ children: installValueLines.map((line) => /* @__PURE__ */ jsx(Text, {
9945
+ dimColor: true,
9946
+ children: line
9947
+ }, line))
9948
+ }), /* @__PURE__ */ jsx(PickerMenu, {
9949
+ message: `Select clients to install the PostHog MCP server${clients.some((c) => c.supportsPlugin) ? " and plugin" : ""}`,
9935
9950
  options: clients.map((c) => ({
9936
9951
  label: c.name,
9937
9952
  value: c.name,
@@ -9940,9 +9955,14 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
9940
9955
  })),
9941
9956
  mode: "multi",
9942
9957
  onSelect: (selected) => {
9943
- proceedAfterClientPick(Array.isArray(selected) ? selected : [selected]);
9958
+ const names = Array.isArray(selected) ? selected : [selected];
9959
+ if (names.length === 0) {
9960
+ handleSkip();
9961
+ return;
9962
+ }
9963
+ proceedAfterClientPick(names);
9944
9964
  }
9945
- }),
9965
+ })] }),
9946
9966
  phase === "feature-select" && /* @__PURE__ */ jsx(GroupedPickerMenu, {
9947
9967
  message: "Select the PostHog areas your agent can reach",
9948
9968
  groups: AVAILABLE_FEATURES,
@@ -10005,6 +10025,21 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
10005
10025
  icon: "✖",
10006
10026
  note: "Run with --debug for the full output, or report it at github.com/PostHog/wizard/issues."
10007
10027
  }),
10028
+ loginCommands.length > 0 && /* @__PURE__ */ jsxs(Box, {
10029
+ flexDirection: "column",
10030
+ marginBottom: 1,
10031
+ children: [/* @__PURE__ */ jsx(Box, {
10032
+ marginBottom: 1,
10033
+ children: /* @__PURE__ */ jsx(Text, { children: "Authenticate to finish (opens your browser):" })
10034
+ }), loginCommands.map((command) => /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
10035
+ dimColor: true,
10036
+ children: "$ "
10037
+ }), /* @__PURE__ */ jsx(Text, {
10038
+ bold: true,
10039
+ color: Colors.primary,
10040
+ children: command
10041
+ })] }, command))]
10042
+ }),
10008
10043
  finishNotes.map((note) => /* @__PURE__ */ jsxs(Box, {
10009
10044
  flexDirection: "column",
10010
10045
  marginTop: 1,
@@ -10038,7 +10073,37 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
10038
10073
  children: [" ", "(If it didn't open, paste the URL above.)"]
10039
10074
  })
10040
10075
  ]
10041
- }, note.name))
10076
+ }, note.name)),
10077
+ installSucceeded && /* @__PURE__ */ jsxs(Box, {
10078
+ flexDirection: "column",
10079
+ marginTop: finishNotes.length > 0 ? 1 : 0,
10080
+ children: [samplePrompts.length > 0 && /* @__PURE__ */ jsxs(Box, {
10081
+ flexDirection: "column",
10082
+ marginBottom: 1,
10083
+ children: [/* @__PURE__ */ jsx(Text, { children: "Open your client and try a prompt like:" }), samplePrompts.map((prompt) => /* @__PURE__ */ jsxs(Text, { children: [
10084
+ /* @__PURE__ */ jsx(Text, {
10085
+ color: Colors.primary,
10086
+ children: Icons.triangleSmallRight
10087
+ }),
10088
+ " ",
10089
+ /* @__PURE__ */ jsx(Text, {
10090
+ dimColor: true,
10091
+ children: prompt
10092
+ })
10093
+ ] }, prompt))]
10094
+ }), /* @__PURE__ */ jsxs(Text, {
10095
+ dimColor: true,
10096
+ children: [
10097
+ "Take the guided tour anytime with",
10098
+ " ",
10099
+ /* @__PURE__ */ jsx(Text, {
10100
+ bold: true,
10101
+ children: "npx @posthog/wizard mcp tutorial"
10102
+ }),
10103
+ "."
10104
+ ]
10105
+ })]
10106
+ })
10042
10107
  ] }) : flowError ? /* @__PURE__ */ jsxs(Box, {
10043
10108
  flexDirection: "column",
10044
10109
  children: [
@@ -10072,29 +10137,12 @@ const McpScreen = ({ store, installer, mode = "install" }) => {
10072
10137
  };
10073
10138
  //#endregion
10074
10139
  //#region src/tui/tools/mcp/flow.ts
10075
- const MCP_ADD_FLOW = [
10076
- {
10077
- id: "mcp-add",
10078
- label: "Add MCP server",
10079
- screenId: "mcp-add",
10080
- isComplete: (s) => s.mcpComplete
10081
- },
10082
- {
10083
- id: "slack-connect",
10084
- label: "Connect Slack",
10085
- screenId: "slack-connect",
10086
- show: (s) => s.mcpOutcome === "installed",
10087
- isComplete: (s) => s.slackStepDismissed
10088
- },
10089
- {
10090
- id: "mcp-suggested-prompts",
10091
- label: "Suggested prompts",
10092
- screenId: "mcp-suggested-prompts",
10093
- show: (s) => s.mcpOutcome === "installed",
10094
- isComplete: (s) => s.mcpSuggestedPromptsDismissed,
10095
- reportsAsProgramId: "mcp-tutorial"
10096
- }
10097
- ];
10140
+ const MCP_ADD_FLOW = [{
10141
+ id: "mcp-add",
10142
+ label: "Add MCP server",
10143
+ screenId: "mcp-add",
10144
+ isComplete: (s) => s.mcpComplete
10145
+ }];
10098
10146
  /**
10099
10147
  * `wizard mcp remove` — single-step uninstall flow.
10100
10148
  *
@@ -10130,11 +10178,6 @@ const MCP_TUTORIAL_FLOW = [{
10130
10178
  label: "MCP tutorial",
10131
10179
  screenId: "mcp-suggested-prompts",
10132
10180
  isComplete: (s) => s.mcpSuggestedPromptsDismissed
10133
- }, {
10134
- id: "slack-connect",
10135
- label: "Connect Slack",
10136
- screenId: "slack-connect",
10137
- isComplete: (s) => s.slackStepDismissed
10138
10181
  }];
10139
10182
  //#endregion
10140
10183
  //#region src/tui/tools/mcp/services/mcp-role-prompts.copy.ts
@@ -11578,9 +11621,7 @@ async function probeProjectData(args) {
11578
11621
  //#endregion
11579
11622
  //#region src/tui/tools/mcp/screens/McpSuggestedPromptsScreen.tsx
11580
11623
  /**
11581
- * McpSuggestedPromptsScreen — shown after MCP install succeeds in the
11582
- * standalone `wizard mcp add` tool, and as the entry point for
11583
- * `wizard mcp tutorial`.
11624
+ * McpSuggestedPromptsScreen — the `wizard mcp tutorial` screen.
11584
11625
  *
11585
11626
  * Phases:
11586
11627
  * 1. Choose — opens with a Log in / Exit picker, framed by a
@@ -11627,7 +11668,7 @@ const McpSuggestedPromptsScreen = ({ store, services }) => {
11627
11668
  ...properties
11628
11669
  });
11629
11670
  }, [programId]);
11630
- const [phase, setPhase] = useState(store.router.activeProgram === Tool.McpTutorial ? "choose" : "goodbye");
11671
+ const [phase, setPhase] = useState("choose");
11631
11672
  const [profile, setProfile] = useState(null);
11632
11673
  const greeting = useMemo(() => getRoleGreeting(session.roleAtOrganization), [session.roleAtOrganization]);
11633
11674
  const pickerCandidates = useMemo(() => getTutorialPicker(session.roleAtOrganization, session.integration, profile), [
@@ -13313,7 +13354,8 @@ function createMcpSuggestedPromptsServices(store) {
13313
13354
  const shared = { screens: {
13314
13355
  ["mcp-add"]: (store, services) => /* @__PURE__ */ jsx(McpScreen, {
13315
13356
  store,
13316
- installer: services.mcpInstaller
13357
+ installer: services.mcpInstaller,
13358
+ samplePrompts: getRolePrompts(store.session.roleAtOrganization, store.session.integration).slice(0, 3).map((p) => p.prompt)
13317
13359
  }),
13318
13360
  ["mcp-remove"]: (store, services) => /* @__PURE__ */ jsx(McpScreen, {
13319
13361
  store,
@@ -13384,7 +13426,7 @@ const MINT_FAILURE_CONTACT = "Email wizard@posthog.com and tell us what happened
13384
13426
  /** The agent run ended in an error, whatever the reason. Login failures also
13385
13427
  * set an error outro but never had credentials, so they stay on the outro. */
13386
13428
  function isRunFailure(session) {
13387
- return session.outroData?.kind === "error" && session.credentials !== null;
13429
+ return session.outroData?.kind === "error" && session.credentials !== null && session.outroData.errorCode !== ErrorCodes.AgentYaraViolation;
13388
13430
  }
13389
13431
  //#endregion
13390
13432
  //#region src/tui/flow.ts
@@ -13489,10 +13531,6 @@ const MINT_HANDOFF_SEQUENCE = [
13489
13531
  id: "mcp",
13490
13532
  isComplete: (s) => s.mcpComplete
13491
13533
  },
13492
- {
13493
- id: "slack-connect",
13494
- isComplete: (s) => s.slackStepDismissed
13495
- },
13496
13534
  {
13497
13535
  id: "keep-skills",
13498
13536
  isComplete: (s) => s.skillsComplete
@@ -13529,11 +13567,11 @@ var WizardRouter = class {
13529
13567
  if (runFailed && view.mintHandoff === "exit") return "exit";
13530
13568
  if (runFailed && !view.mintHandoff) return "mint-failure";
13531
13569
  if (this.overlays.length > 0) return this.overlays[this.overlays.length - 1];
13570
+ if (!runFailed && session.runPhase === "error" && session.outroData?.kind === "error") return view.outroDismissed ? "exit" : "outro";
13532
13571
  const sequence = runFailed ? MINT_HANDOFF_SEQUENCE : this.sequence;
13533
13572
  for (const entry of sequence) {
13534
13573
  if (entry.show && !entry.show(view)) continue;
13535
13574
  if (entry.isComplete && entry.isComplete(view)) continue;
13536
- if (entry.id === "auth" && session.runPhase === "error" && session.outroData) return "outro";
13537
13575
  return entry.id;
13538
13576
  }
13539
13577
  return sequence[sequence.length - 1].id;
@@ -15220,8 +15258,12 @@ const OutroScreen = ({ store }) => {
15220
15258
  bold: true,
15221
15259
  children: ["✘ ", outroData.message || "An error occurred"]
15222
15260
  }),
15223
- outroData.body && /* @__PURE__ */ jsx(Box, {
15261
+ outroData.instruction && /* @__PURE__ */ jsx(Box, {
15224
15262
  marginTop: 1,
15263
+ children: /* @__PURE__ */ jsx(Text, { children: outroData.instruction })
15264
+ }),
15265
+ outroData.body && /* @__PURE__ */ jsx(Box, {
15266
+ marginTop: outroData.instruction ? 0 : 1,
15225
15267
  children: /* @__PURE__ */ jsx(Text, {
15226
15268
  dimColor: true,
15227
15269
  children: outroData.body
@@ -15229,7 +15271,14 @@ const OutroScreen = ({ store }) => {
15229
15271
  }),
15230
15272
  outroData.docsUrl && /* @__PURE__ */ jsx(Box, {
15231
15273
  marginTop: 1,
15232
- children: /* @__PURE__ */ jsxs(Text, { children: ["Docs: ", /* @__PURE__ */ jsx(Text, {
15274
+ flexDirection: "column",
15275
+ children: outroData.docsLabel ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Text, {
15276
+ dimColor: true,
15277
+ children: outroData.docsLabel
15278
+ }), /* @__PURE__ */ jsx(Text, {
15279
+ color: "cyan",
15280
+ children: outroData.docsUrl
15281
+ })] }) : /* @__PURE__ */ jsxs(Text, { children: ["Docs: ", /* @__PURE__ */ jsx(Text, {
15233
15282
  color: "cyan",
15234
15283
  children: outroData.docsUrl
15235
15284
  })] })
@@ -15244,10 +15293,14 @@ const OutroScreen = ({ store }) => {
15244
15293
  })
15245
15294
  }),
15246
15295
  /* @__PURE__ */ jsx(Box, {
15247
- marginTop: 1,
15248
- children: /* @__PURE__ */ jsx(Text, {
15296
+ marginTop: outroData.kind === "error" ? 2 : 1,
15297
+ children: /* @__PURE__ */ jsxs(Text, {
15249
15298
  color: Colors.muted,
15250
- children: "Press any key to continue"
15299
+ children: [
15300
+ "Press any key to",
15301
+ " ",
15302
+ outroData.kind === "error" ? "exit" : "continue"
15303
+ ]
15251
15304
  })
15252
15305
  })
15253
15306
  ]
@@ -15329,6 +15382,7 @@ var WizardStore = class {
15329
15382
  _enterScreenHooks = /* @__PURE__ */ new Map();
15330
15383
  /** Gate promises derived from program step definitions. */
15331
15384
  _gates = /* @__PURE__ */ new Map();
15385
+ _mcpOutcomeReported = false;
15332
15386
  version = "";
15333
15387
  /** Navigation router — resolves active screen from session state. */
15334
15388
  router;
@@ -15851,7 +15905,10 @@ var WizardStore = class {
15851
15905
  addDiscoveredFeature(feature) {
15852
15906
  this.sessions.addDiscoveredFeature(feature);
15853
15907
  }
15854
- setMcpComplete(outcome = "skipped", installedClients = [], featuresSelected, loginCommands = []) {
15908
+ /** Capture the MCP step's outcome once; the screen reports it as the results show, before Enter. */
15909
+ reportMcpOutcome(outcome, installedClients = [], featuresSelected) {
15910
+ if (this._mcpOutcomeReported) return;
15911
+ this._mcpOutcomeReported = true;
15855
15912
  const featuresPayload = outcome === "installed" && featuresSelected !== void 0 ? { mcp_features_selected: featuresSelected } : {};
15856
15913
  analytics.wizardCapture("mcp complete", {
15857
15914
  mcp_outcome: outcome,
@@ -15859,6 +15916,10 @@ var WizardStore = class {
15859
15916
  ...featuresPayload,
15860
15917
  ...sessionProperties(this.session)
15861
15918
  });
15919
+ }
15920
+ /** Complete the MCP step; its `mcp complete` capture goes through `reportMcpOutcome`, so once per store. */
15921
+ setMcpComplete(outcome = "skipped", installedClients = [], featuresSelected, loginCommands = []) {
15922
+ this.reportMcpOutcome(outcome, installedClients, featuresSelected);
15862
15923
  this._write({
15863
15924
  mcpComplete: true,
15864
15925
  mcpOutcome: outcome,
@@ -16028,19 +16089,10 @@ var WizardStore = class {
16028
16089
  list.push(fn);
16029
16090
  this._enterScreenHooks.set(screen, list);
16030
16091
  }
16031
- /**
16032
- * The program `screen` reports under — its step's `reportsAsProgramId` if it
16033
- * claims one, else the running program (also the fallback for overlays and
16034
- * screens with no owning step).
16035
- */
16036
- _programIdForScreen(screen) {
16037
- const program = this.router.activeProgram;
16038
- return flowOwner(program).flow.find((s) => s.screenId === screen)?.reportsAsProgramId ?? program;
16039
- }
16040
16092
  /** The program the visible screen reports under; screens stamp this on their
16041
16093
  * own events rather than relying on the run-level `program_id` tag. */
16042
16094
  get analyticsProgramId() {
16043
- return this._programIdForScreen(this.router.resolve(this));
16095
+ return this.router.activeProgram;
16044
16096
  }
16045
16097
  /**
16046
16098
  * Detect screen transitions, run enter-screen hooks, and fire analytics.
@@ -16055,7 +16107,7 @@ var WizardStore = class {
16055
16107
  if (hooks) for (const fn of hooks) fn();
16056
16108
  analytics.wizardCapture(`screen ${next}`, {
16057
16109
  from_screen: prev,
16058
- program_id: this._programIdForScreen(next),
16110
+ program_id: this.router.activeProgram,
16059
16111
  ...sessionProperties(this.session)
16060
16112
  });
16061
16113
  }
@@ -16159,4 +16211,4 @@ function releaseTerminal() {
16159
16211
  //#endregion
16160
16212
  export { AUDIT_AREA_SLIDES as A, totalTokenCount as B, assembleProfile as C, getTuiProgram as D, IssueTable as E, ContentSequencer as F, ModalOverlay as G, LogViewer as H, HNViewer as I, ProgressList as J, ConfirmationInput as K, TabContainer as L, IntroScreenLayout as M, PRIVACY_PANEL_LABEL as N, displayProgress as O, PrivacyPanel as P, getContentBlocks$5 as Q, ScreenContainer as R, McpSuggestedPromptsScreen as S, McpScreen as T, LinkText as U, EventPlanViewer as V, extractUrls as W, SplitView as X, LoadingBox as Y, CardLayout as Z, getTuiTool as _, SlackConnectScreen as a, extractOAuthCode as b, LearnCard as c, MINT_FAILURE_BODY as d, MINT_FAILURE_CONTACT as f, listFlowOwners as g, flowOwner as h, OutroScreen as i, AuditChecksViewer as j, useDismissOnAnyKey as k, AiOptInRequiredScreen as l, isRunFailure as m, releaseTerminal as n, TipsCard as o, MINT_FAILURE_MESSAGE as p, GroupedPickerMenu as q, WizardStore as r, VisualizerTab as s, enterDarkTerminal as t, ServiceHealthList as u, seededProfile as v, TAILORED_ROLES as w, abortOnScreens as x, getOrAskForProjectData as y, ViewportTooSmall as z };
16161
16213
 
16162
- //# sourceMappingURL=terminal-J3OD3dN0.js.map
16214
+ //# sourceMappingURL=terminal-Z4hCXfie.js.map