@posthog/wizard 2.70.0 → 2.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/{add-mcp-server-to-clients-D2z2adQL.js → add-mcp-server-to-clients-B6-ZL--P.js} +4 -4
  2. package/dist/{add-mcp-server-to-clients-D2z2adQL.js.map → add-mcp-server-to-clients-B6-ZL--P.js.map} +1 -1
  3. package/dist/{agent-interface-NZHof8u3.js → agent-interface-DFm4jB4d.js} +108 -15
  4. package/dist/agent-interface-DFm4jB4d.js.map +1 -0
  5. package/dist/{agent-prompt-loader-CQijHoX1.js → agent-prompt-loader-Bi3IzSBW.js} +5 -5
  6. package/dist/{agent-prompt-loader-CQijHoX1.js.map → agent-prompt-loader-Bi3IzSBW.js.map} +1 -1
  7. package/dist/{agent-runner-CK9z7-0z.js → agent-runner-Cp6iLqDk.js} +56 -18
  8. package/dist/agent-runner-Cp6iLqDk.js.map +1 -0
  9. package/dist/{analytics-DXPSL5IY.js → analytics-D54mLptm.js} +3 -3
  10. package/dist/{analytics-DXPSL5IY.js.map → analytics-D54mLptm.js.map} +1 -1
  11. package/dist/analytics-Ge1LsCNg.js +2 -0
  12. package/dist/{api-CeapT_rn.js → api-BNBVOguz.js} +23 -4
  13. package/dist/{api-CeapT_rn.js.map → api-BNBVOguz.js.map} +1 -1
  14. package/dist/bin.js +90 -79
  15. package/dist/bin.js.map +1 -1
  16. package/dist/{bounded-fs-DdHuSE1X.js → bounded-fs-DHIaH3Sc.js} +3 -3
  17. package/dist/{bounded-fs-DdHuSE1X.js.map → bounded-fs-DHIaH3Sc.js.map} +1 -1
  18. package/dist/{ci-install-c-n8dJng.js → ci-install-Can8LRdJ.js} +5 -5
  19. package/dist/{ci-install-c-n8dJng.js.map → ci-install-Can8LRdJ.js.map} +1 -1
  20. package/dist/{debug-D2KQFr3-.js → debug-C4RPcEIX.js} +1 -1
  21. package/dist/{debug-D5YT7Lil.js → debug-YQdeZulR.js} +4 -3
  22. package/dist/debug-YQdeZulR.js.map +1 -0
  23. package/dist/{env-api-key-ClK4nxHy.js → env-api-key-9yogO8OI.js} +2 -2
  24. package/dist/{env-api-key-ClK4nxHy.js.map → env-api-key-9yogO8OI.js.map} +1 -1
  25. package/dist/{environment-DbDconLv.js → environment-6ZuAWRpQ.js} +4 -4
  26. package/dist/{environment-DbDconLv.js.map → environment-6ZuAWRpQ.js.map} +1 -1
  27. package/dist/{errors-BSdz2lsl.js → errors-u8z27V-x.js} +4 -2
  28. package/dist/errors-u8z27V-x.js.map +1 -0
  29. package/dist/{file-watcher-CQj0wp1a.js → file-watcher-CeWdvMVT.js} +2 -2
  30. package/dist/{file-watcher-CQj0wp1a.js.map → file-watcher-CeWdvMVT.js.map} +1 -1
  31. package/dist/{headless-ui-BKU7MJQf.js → headless-ui-BxSVgNoT.js} +2 -2
  32. package/dist/{headless-ui-BKU7MJQf.js.map → headless-ui-BxSVgNoT.js.map} +1 -1
  33. package/dist/{interactive-Bfvo61oS.js → interactive-CRR9zPl4.js} +2 -2
  34. package/dist/{interactive-Bfvo61oS.js.map → interactive-CRR9zPl4.js.map} +1 -1
  35. package/dist/{mcp-C_pqYZQY.js → mcp-D_rRzruj.js} +2 -2
  36. package/dist/{mcp-C_pqYZQY.js.map → mcp-D_rRzruj.js.map} +1 -1
  37. package/dist/{mcp-prompt-streaming-DOHJxT8K.js → mcp-prompt-streaming-DRAK8CMP.js} +5 -4
  38. package/dist/mcp-prompt-streaming-DRAK8CMP.js.map +1 -0
  39. package/dist/{non-interactive-CkBbj2As.js → non-interactive-1EJRlN6u.js} +3 -3
  40. package/dist/{non-interactive-CkBbj2As.js.map → non-interactive-1EJRlN6u.js.map} +1 -1
  41. package/dist/{orchestrator-tools-DaVjzCRn.js → orchestrator-tools-DjZWqWmd.js} +3 -3
  42. package/dist/{orchestrator-tools-DaVjzCRn.js.map → orchestrator-tools-DjZWqWmd.js.map} +1 -1
  43. package/dist/{package-manager-BD3WR7Ta.js → package-manager-DMbzbdkL.js} +2 -2
  44. package/dist/{package-manager-BD3WR7Ta.js.map → package-manager-DMbzbdkL.js.map} +1 -1
  45. package/dist/{pi-uDtK02b4.js → pi-D4JQMC-7.js} +18 -15
  46. package/dist/pi-D4JQMC-7.js.map +1 -0
  47. package/dist/{playground-ELiBuGN0.js → playground-Y1nSGXpn.js} +43 -8
  48. package/dist/playground-Y1nSGXpn.js.map +1 -0
  49. package/dist/{posthog-DISFn-54.js → posthog-D9VwcWvJ.js} +2 -2
  50. package/dist/{posthog-DISFn-54.js.map → posthog-D9VwcWvJ.js.map} +1 -1
  51. package/dist/{posthog-integration-BGk6dYzS.js → posthog-integration-B8f4xRBd.js} +19 -19
  52. package/dist/posthog-integration-B8f4xRBd.js.map +1 -0
  53. package/dist/{provisioning-DoKcXygK.js → provisioning-f7lA29tW.js} +14 -5
  54. package/dist/provisioning-f7lA29tW.js.map +1 -0
  55. package/dist/{queue-tools-B75RxrcC.js → queue-tools-DGaHf3n-.js} +3 -3
  56. package/dist/{queue-tools-B75RxrcC.js.map → queue-tools-DGaHf3n-.js.map} +1 -1
  57. package/dist/{registry-DbwlUbvA.js → registry-D1By1SgH.js} +5 -5
  58. package/dist/{registry-DbwlUbvA.js.map → registry-D1By1SgH.js.map} +1 -1
  59. package/dist/{security-lqzh7NaZ.js → security-C2c3_Ycy.js} +5 -5
  60. package/dist/{security-lqzh7NaZ.js.map → security-C2c3_Ycy.js.map} +1 -1
  61. package/dist/{setup-utils-DeIoqwPw.js → setup-utils-BRrCeajl.js} +42 -11
  62. package/dist/setup-utils-BRrCeajl.js.map +1 -0
  63. package/dist/{start-tui-ebV_ynrs.js → start-tui-r4Spgptv.js} +287 -23
  64. package/dist/start-tui-r4Spgptv.js.map +1 -0
  65. package/dist/{steps-BB2izees.js → steps-BZd65XfI.js} +7 -7
  66. package/dist/{steps-BB2izees.js.map → steps-BZd65XfI.js.map} +1 -1
  67. package/dist/{store-BbDrhStP.js → store-DGVXu7xt.js} +25 -6
  68. package/dist/store-DGVXu7xt.js.map +1 -0
  69. package/dist/{subagent-oTBoYK3h.js → subagent-BaMxO7OT.js} +2 -2
  70. package/dist/{subagent-oTBoYK3h.js.map → subagent-BaMxO7OT.js.map} +1 -1
  71. package/dist/{task-BPsA2HrW.js → task-DpKoEZ5I.js} +13 -13
  72. package/dist/{task-BPsA2HrW.js.map → task-DpKoEZ5I.js.map} +1 -1
  73. package/dist/{task-stream-DffFXskR.js → task-stream-CdrBraqP.js} +6 -6
  74. package/dist/{task-stream-DffFXskR.js.map → task-stream-CdrBraqP.js.map} +1 -1
  75. package/dist/{tasks-CmyTWgU7.js → tasks-KsP66Cis.js} +2 -2
  76. package/dist/{tasks-CmyTWgU7.js.map → tasks-KsP66Cis.js.map} +1 -1
  77. package/dist/{telemetry-DfZNqwpb.js → telemetry-DedDTtSa.js} +3 -3
  78. package/dist/{telemetry-DfZNqwpb.js.map → telemetry-DedDTtSa.js.map} +1 -1
  79. package/dist/{terminal-DTJLXrQX.js → terminal-BH8yLclG.js} +107 -61
  80. package/dist/terminal-BH8yLclG.js.map +1 -0
  81. package/dist/{tools-B4s78y8L.js → tools-CJw5vnZd.js} +6 -6
  82. package/dist/{tools-B4s78y8L.js.map → tools-CJw5vnZd.js.map} +1 -1
  83. package/dist/{wizard-abort-XQFt0vkZ.js → wizard-abort-D54j2gmb.js} +5 -5
  84. package/dist/{wizard-abort-XQFt0vkZ.js.map → wizard-abort-D54j2gmb.js.map} +1 -1
  85. package/dist/{wizard-abort-CE6vlOGM.js → wizard-abort-Q1NiYELE.js} +1 -1
  86. package/dist/{wizard-session-Bki7dQhv.js → wizard-session-CwQPZN4y.js} +3 -1
  87. package/dist/wizard-session-CwQPZN4y.js.map +1 -0
  88. package/dist/{wizard-session-gbYCXdBf.js → wizard-session-Dwc1Rh_7.js} +1 -1
  89. package/dist/yara-hooks-BI6WY0Sl.js +2 -0
  90. package/dist/{yara-hooks-gZxdqlkx.js → yara-hooks-CL2LVEgO.js} +4 -4
  91. package/dist/{yara-hooks-gZxdqlkx.js.map → yara-hooks-CL2LVEgO.js.map} +1 -1
  92. package/package.json +1 -1
  93. package/dist/agent-interface-NZHof8u3.js.map +0 -1
  94. package/dist/agent-runner-CK9z7-0z.js.map +0 -1
  95. package/dist/analytics-CbkGZjMp.js +0 -2
  96. package/dist/debug-D5YT7Lil.js.map +0 -1
  97. package/dist/errors-BSdz2lsl.js.map +0 -1
  98. package/dist/mcp-prompt-streaming-DOHJxT8K.js.map +0 -1
  99. package/dist/pi-uDtK02b4.js.map +0 -1
  100. package/dist/playground-ELiBuGN0.js.map +0 -1
  101. package/dist/posthog-integration-BGk6dYzS.js.map +0 -1
  102. package/dist/provisioning-DoKcXygK.js.map +0 -1
  103. package/dist/setup-utils-DeIoqwPw.js.map +0 -1
  104. package/dist/start-tui-ebV_ynrs.js.map +0 -1
  105. package/dist/store-BbDrhStP.js.map +0 -1
  106. package/dist/terminal-DTJLXrQX.js.map +0 -1
  107. package/dist/wizard-session-Bki7dQhv.js.map +0 -1
  108. package/dist/yara-hooks-COTd_ALD.js +0 -2
@@ -1,22 +1,24 @@
1
- import { l as ErrorCodes } from "./errors-BSdz2lsl.js";
2
- import { $ as REMOTE_SKILLS_BASE_URL, K as POSTHOG_ORG_AI_SETTINGS_URL, L as Integration, R as OAUTH_PORTS, U as POSTHOG_DOCS_URL, Z as POSTHOG_TERMS_URL, d as relativeToInstallDir, g as SIGNUP_WIZARD_READINESS_CONFIG, l as WIZARD_LOG_FILE, p as setUI, q as POSTHOG_PRIVACY_URL, s as logToFile, v as getBlockingServiceKeys, z as OAUTH_TIMEOUT_MS } from "./debug-D5YT7Lil.js";
3
- import { t as ADDITIONAL_FEATURE_LABELS } from "./wizard-session-Bki7dQhv.js";
4
- import { n as analytics } from "./analytics-DXPSL5IY.js";
5
- import { i as readProjectFile, t as IGNORED_DIRS } from "./bounded-fs-DdHuSE1X.js";
6
- import { o as extractOAuthCode, t as getOrAskForProjectData } from "./setup-utils-DeIoqwPw.js";
7
- import { t as ApiError } from "./api-CeapT_rn.js";
8
- import { i as wizardAbort } from "./wizard-abort-XQFt0vkZ.js";
9
- import { a as formatCostUsd, o as formatTokenCount } from "./agent-runner-CK9z7-0z.js";
10
- import { O as downloadSkill, k as fetchSkillMenu } from "./agent-interface-NZHof8u3.js";
11
- import { _ as AUDIT_CHECKS_KEY, b as coerceAuditChecks, g as AUDIT_CHECKS_FILE, x as getAuditChecks, y as AUDIT_SEVERITY_STYLE } from "./yara-hooks-gZxdqlkx.js";
12
- import { t as FRAMEWORK_REGISTRY } from "./registry-DbwlUbvA.js";
13
- import { T as detectProjectsWithAgent, h as Icons, m as Colors, t as SETUP_REPORT_FILE, x as getDetectedWarehouseSources } from "./posthog-integration-BGk6dYzS.js";
14
- import { A as STRIPE_SDKS, C as MANUAL_SDK_VARIANTS, D as fetchHealthIssues, O as getContentBlocks, S as MANUAL_SDK_INSTALL, T as SOURCE_MAPS_CONTEXT_KEYS, _ as detectSelfDrivingIntegrationProjects, a as useStdoutDimensions, b as DISPLAY_NAME, f as Program, g as PRICING_SHORT, h as PRICING_LONG, k as POSTHOG_SDKS, m as NO_DEFAULT_LIMIT, n as useKeyBindings, p as getProgramConfig, t as PickerMenu, v as SELF_DRIVING_INTEGRATE_PATH_KEY, y as AUTOMATABLE_VARIANTS } from "./bin.js";
15
- import { r as totalTokenCount, t as WizardStore } from "./store-BbDrhStP.js";
16
- import { A as EventPlanViewer, C as VisualizerTab, D as HNViewer, F as ConfirmationInput, L as ProgressList, M as LinkText, N as extractUrls, O as TabContainer, P as ModalOverlay, R as LoadingBox, S as ServiceHealthList, T as LearnCard, a as useSkillEntry, b as SEVERITY_LABEL, c as SlackConnectScreen, d as AuditChecksViewer, f as seedDemoEvents, g as probeProjectData, i as SkillSourceInfo, j as LogViewer, k as ScreenContainer, l as AUDIT_AREA_SLIDES, m as McpSuggestedPromptsScreen, n as releaseTerminal, o as OutroScreen, r as AiOptInRequiredScreen, s as useDismissOnAnyKey, t as enterDarkTerminal, u as VisualBox, v as McpScreen, w as TipsCard, x as SEVERITY_ORDER, y as IssueTable, z as SplitView } from "./terminal-DTJLXrQX.js";
1
+ import { l as ErrorCodes } from "./errors-u8z27V-x.js";
2
+ import { $ as REMOTE_SKILLS_BASE_URL, K as POSTHOG_ORG_AI_SETTINGS_URL, L as Integration, R as OAUTH_PORTS, U as POSTHOG_DOCS_URL, Z as POSTHOG_TERMS_URL, d as relativeToInstallDir, g as SIGNUP_WIZARD_READINESS_CONFIG, l as WIZARD_LOG_FILE, p as setUI, q as POSTHOG_PRIVACY_URL, s as logToFile, v as getBlockingServiceKeys, z as OAUTH_TIMEOUT_MS } from "./debug-YQdeZulR.js";
3
+ import { t as ADDITIONAL_FEATURE_LABELS } from "./wizard-session-CwQPZN4y.js";
4
+ import { n as analytics } from "./analytics-D54mLptm.js";
5
+ import { n as openTrackedLink } from "./telemetry-DedDTtSa.js";
6
+ import { i as readProjectFile, t as IGNORED_DIRS } from "./bounded-fs-DHIaH3Sc.js";
7
+ import { o as extractOAuthCode, t as getOrAskForProjectData } from "./setup-utils-BRrCeajl.js";
8
+ import { c as getIntegrationAuthorizeUrl } from "./provisioning-f7lA29tW.js";
9
+ import { r as fetchGithubConnected, t as ApiError } from "./api-BNBVOguz.js";
10
+ import { i as wizardAbort } from "./wizard-abort-D54j2gmb.js";
11
+ import { A as fetchSkillMenu, k as downloadSkill } from "./agent-interface-DFm4jB4d.js";
12
+ import { a as formatCostUsd, o as formatTokenCount } from "./agent-runner-Cp6iLqDk.js";
13
+ import { _ as AUDIT_CHECKS_KEY, b as coerceAuditChecks, g as AUDIT_CHECKS_FILE, x as getAuditChecks, y as AUDIT_SEVERITY_STYLE } from "./yara-hooks-CL2LVEgO.js";
14
+ import { t as FRAMEWORK_REGISTRY } from "./registry-D1By1SgH.js";
15
+ import { T as detectProjectsWithAgent, h as Icons, m as Colors, t as SETUP_REPORT_FILE, x as getDetectedWarehouseSources } from "./posthog-integration-B8f4xRBd.js";
16
+ import { A as getContentBlocks, D as SOURCE_MAPS_CONTEXT_KEYS, M as STRIPE_SDKS, S as DISPLAY_NAME, T as MANUAL_SDK_VARIANTS, _ as detectSelfDrivingIntegrationProjects, a as useStdoutDimensions, b as SELF_DRIVING_INTEGRATE_PATH_KEY, f as Program, g as PRICING_SHORT, h as PRICING_LONG, j as POSTHOG_SDKS, k as fetchHealthIssues, m as NO_DEFAULT_LIMIT, n as useKeyBindings, p as getProgramConfig, t as PickerMenu, v as GITHUB_REQUIRED_BODY, w as MANUAL_SDK_INSTALL, x as AUTOMATABLE_VARIANTS, y as GITHUB_REQUIRED_MESSAGE } from "./bin.js";
17
+ import { r as totalTokenCount, t as WizardStore } from "./store-DGVXu7xt.js";
18
+ import { B as SplitView, C as VisualizerTab, D as HNViewer, F as ModalOverlay, I as ConfirmationInput, M as LogViewer, N as LinkText, O as TabContainer, P as extractUrls, R as ProgressList, S as ServiceHealthList, T as LearnCard, a as useSkillEntry, b as SEVERITY_LABEL, c as SlackConnectScreen, d as AuditChecksViewer, f as seedDemoEvents, g as probeProjectData, i as SkillSourceInfo, j as EventPlanViewer, k as ScreenContainer, l as AUDIT_AREA_SLIDES, m as McpSuggestedPromptsScreen, n as releaseTerminal, o as OutroScreen, r as AiOptInRequiredScreen, s as useDismissOnAnyKey, t as enterDarkTerminal, u as VisualBox, v as McpScreen, w as TipsCard, x as SEVERITY_ORDER, y as IssueTable, z as LoadingBox } from "./terminal-BH8yLclG.js";
17
19
  import { c as namesWithStatus, d as toClientResult, l as redactSecrets, t as ALL_FEATURE_VALUES } from "./defaults-DI642M3n.js";
18
- import { t as startFileWatcher } from "./file-watcher-CQj0wp1a.js";
19
- import { a as getSupportedClients, c as removeMCPServer, i as getInstalledClients, o as getSupportedPluginClients, s as installPlugins, u as isPluginCapable } from "./add-mcp-server-to-clients-D2z2adQL.js";
20
+ import { t as startFileWatcher } from "./file-watcher-CeWdvMVT.js";
21
+ import { a as getSupportedClients, c as removeMCPServer, i as getInstalledClients, o as getSupportedPluginClients, s as installPlugins, u as isPluginCapable } from "./add-mcp-server-to-clients-B6-ZL--P.js";
20
22
  import { existsSync, readFileSync, readdirSync } from "fs";
21
23
  import path, { join } from "path";
22
24
  import { join as join$1 } from "node:path";
@@ -67,6 +69,9 @@ var InkUI = class {
67
69
  setCredentials(credentials) {
68
70
  this.store.setCredentials(credentials);
69
71
  }
72
+ setAccessToken(credentials) {
73
+ this.store.setAccessToken(credentials);
74
+ }
70
75
  setRoleAtOrganization(role) {
71
76
  this.store.setRoleAtOrganization(role);
72
77
  }
@@ -1288,7 +1293,7 @@ const FrameworkPicker = ({ store, onComplete }) => {
1288
1293
  })),
1289
1294
  onSelect: (value) => {
1290
1295
  const integration = Array.isArray(value) ? value[0] : value;
1291
- import("./registry-DbwlUbvA.js").then((n) => n.n).then(({ FRAMEWORK_REGISTRY }) => {
1296
+ import("./registry-D1By1SgH.js").then((n) => n.n).then(({ FRAMEWORK_REGISTRY }) => {
1292
1297
  const config = FRAMEWORK_REGISTRY[integration];
1293
1298
  store.setFrameworkConfig(integration, config);
1294
1299
  store.setDetectedFramework(config.metadata.name);
@@ -3695,6 +3700,201 @@ const SelfDrivingHandoffScreen = ({ store }) => {
3695
3700
  });
3696
3701
  };
3697
3702
  //#endregion
3703
+ //#region src/ui/tui/hooks/useGithubConnection.ts
3704
+ /**
3705
+ * Polls `/integrations/` until the PostHog GitHub App shows up, writing the
3706
+ * result to the session so the Self-driving GitHub gate can advance.
3707
+ *
3708
+ * Installing the App is a manual browser step, so polling is what flips the
3709
+ * gate once the user comes back. The first tick also resolves the session's
3710
+ * unknown (`null`) state.
3711
+ */
3712
+ const POLL_INTERVAL_MS = 3e3;
3713
+ function useGithubConnection(store) {
3714
+ const credentials = store.session.credentials;
3715
+ const connected = store.session.githubConnected === true;
3716
+ useEffect(() => {
3717
+ if (!credentials || connected) return;
3718
+ const controller = new AbortController();
3719
+ let stopped = false;
3720
+ let timer;
3721
+ let errorReported = false;
3722
+ /** A check that came back "not connected" — including a failed one. */
3723
+ const settleUnknown = () => {
3724
+ if (store.session.githubConnected === null) store.setGithubConnected(false);
3725
+ };
3726
+ const wait = () => new Promise((resolve) => {
3727
+ timer = setTimeout(resolve, POLL_INTERVAL_MS);
3728
+ });
3729
+ (async () => {
3730
+ while (!stopped) {
3731
+ try {
3732
+ const isConnected = await fetchGithubConnected(credentials.accessToken, credentials.projectId, credentials.host.apiHost, controller.signal);
3733
+ if (stopped) return;
3734
+ if (isConnected) {
3735
+ if (store.session.githubConnected === false) analytics.wizardCapture("github connect completed");
3736
+ store.setGithubConnected(true);
3737
+ return;
3738
+ }
3739
+ settleUnknown();
3740
+ } catch (err) {
3741
+ if (stopped) return;
3742
+ if (!errorReported) {
3743
+ errorReported = true;
3744
+ analytics.captureException(err instanceof Error ? err : new Error(String(err)), { step: "github_connected_check" });
3745
+ }
3746
+ settleUnknown();
3747
+ }
3748
+ await wait();
3749
+ }
3750
+ })();
3751
+ return () => {
3752
+ stopped = true;
3753
+ if (timer) clearTimeout(timer);
3754
+ controller.abort();
3755
+ };
3756
+ }, [
3757
+ credentials,
3758
+ connected,
3759
+ store
3760
+ ]);
3761
+ }
3762
+ //#endregion
3763
+ //#region src/ui/tui/screens/SelfDrivingGitHubScreen.tsx
3764
+ /**
3765
+ * SelfDrivingGitHubScreen — the "Connect GitHub" gate, shown after the handoff
3766
+ * and before the Self-driving run.
3767
+ *
3768
+ * Self-driving cannot research findings or open fixes without code access, so
3769
+ * the GitHub App is a hard requirement. The agent used to ask for it mid-run
3770
+ * via `wizard_ask` and abort when the answer came back declined — but a
3771
+ * `wizard_ask` timeout resolves to the same cancelled value as a real decline,
3772
+ * so a user who stepped away had their run killed as if they had refused.
3773
+ * Gating here instead makes the requirement cheap (no agent has started),
3774
+ * unambiguous (declining is an explicit pick), and un-timeoutable (the screen
3775
+ * waits as long as the browser install takes).
3776
+ *
3777
+ * Unlike SlackConnectScreen this is not skippable: declining ends the run on
3778
+ * the outro rather than continuing without it. The connection poll lives in
3779
+ * {@link useGithubConnection}.
3780
+ */
3781
+ const SelfDrivingGitHubScreen = ({ store }) => {
3782
+ useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
3783
+ const credentials = store.session.credentials;
3784
+ const connectedState = store.session.githubConnected;
3785
+ const connected = connectedState === true;
3786
+ const authorizeUrl = credentials ? getIntegrationAuthorizeUrl(credentials.host.appHost, credentials.projectId, "github") : null;
3787
+ useGithubConnection(store);
3788
+ const [installOpened, setInstallOpened] = useState(false);
3789
+ const impressionFired = useRef(false);
3790
+ useEffect(() => {
3791
+ if (connectedState === null || impressionFired.current) return;
3792
+ impressionFired.current = true;
3793
+ analytics.wizardCapture("github connect shown", { already_connected: connected });
3794
+ }, [connectedState, connected]);
3795
+ const openInstall = () => {
3796
+ if (!authorizeUrl) return;
3797
+ analytics.wizardCapture("github connect opened");
3798
+ openTrackedLink(authorizeUrl, "self-driving-github-connect");
3799
+ setInstallOpened(true);
3800
+ };
3801
+ const decline = () => {
3802
+ analytics.wizardCapture("github connect declined", { install_opened: installOpened });
3803
+ store.declineGithub({
3804
+ kind: "cancel",
3805
+ message: GITHUB_REQUIRED_MESSAGE,
3806
+ body: GITHUB_REQUIRED_BODY
3807
+ });
3808
+ };
3809
+ const handleSelect = (value) => {
3810
+ if ((Array.isArray(value) ? value[0] : value) === "open") openInstall();
3811
+ else decline();
3812
+ };
3813
+ useKeyBindings("self-driving-github", [{
3814
+ match: "escape",
3815
+ label: "esc",
3816
+ action: connected ? "continue" : "end setup",
3817
+ handler: () => {
3818
+ if (!connected) decline();
3819
+ }
3820
+ }]);
3821
+ if (credentials && connectedState === null) return /* @__PURE__ */ jsx(Box, {
3822
+ flexDirection: "column",
3823
+ flexGrow: 1,
3824
+ marginTop: 1,
3825
+ children: /* @__PURE__ */ jsx(LoadingBox, { message: "Checking for an existing GitHub connection..." })
3826
+ });
3827
+ if (connected) return /* @__PURE__ */ jsxs(Box, {
3828
+ flexDirection: "column",
3829
+ flexGrow: 1,
3830
+ marginTop: 1,
3831
+ children: [
3832
+ /* @__PURE__ */ jsxs(Text, {
3833
+ bold: true,
3834
+ color: Colors.success,
3835
+ children: [Icons.check, " GitHub connected"]
3836
+ }),
3837
+ /* @__PURE__ */ jsx(Box, {
3838
+ marginTop: 1,
3839
+ children: /* @__PURE__ */ jsx(Text, { children: "Self-driving can research findings in your code and open fixes." })
3840
+ }),
3841
+ /* @__PURE__ */ jsx(Box, {
3842
+ marginTop: 1,
3843
+ children: /* @__PURE__ */ jsx(LoadingBox, { message: "Starting Self-driving setup..." })
3844
+ })
3845
+ ]
3846
+ });
3847
+ return /* @__PURE__ */ jsx(Box, {
3848
+ flexDirection: "column",
3849
+ flexGrow: 1,
3850
+ children: /* @__PURE__ */ jsxs(Box, {
3851
+ marginTop: 1,
3852
+ flexDirection: "column",
3853
+ children: [
3854
+ /* @__PURE__ */ jsx(Text, {
3855
+ bold: true,
3856
+ color: Colors.accent,
3857
+ children: installOpened ? "Finish connecting GitHub" : "Connect GitHub"
3858
+ }),
3859
+ /* @__PURE__ */ jsx(Box, {
3860
+ marginTop: 1,
3861
+ children: /* @__PURE__ */ jsx(Text, { children: installOpened ? "We've opened the PostHog GitHub App install in your browser. Approve access there — we'll detect it automatically and continue." : "Self-driving needs GitHub access to research findings in your code and open fixes, so setup cannot finish without it." })
3862
+ }),
3863
+ !installOpened && /* @__PURE__ */ jsx(Box, {
3864
+ marginTop: 1,
3865
+ children: /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsxs(Text, {
3866
+ color: "cyan",
3867
+ children: [Icons.diamond, " "]
3868
+ }), "Grant it the repos you want Self-driving to work with — include this project's repo so it can also watch its issues."] })
3869
+ }),
3870
+ authorizeUrl && /* @__PURE__ */ jsx(Box, {
3871
+ marginTop: 1,
3872
+ children: /* @__PURE__ */ jsxs(Text, {
3873
+ dimColor: true,
3874
+ children: [installOpened ? "Install page: " : "Install it: ", /* @__PURE__ */ jsx(Text, {
3875
+ color: "cyan",
3876
+ children: authorizeUrl
3877
+ })]
3878
+ })
3879
+ }),
3880
+ /* @__PURE__ */ jsx(Box, {
3881
+ marginTop: 1,
3882
+ children: /* @__PURE__ */ jsx(PickerMenu, {
3883
+ options: [{
3884
+ label: installOpened ? "Re-open GitHub App install" : "Open GitHub App install",
3885
+ value: "open"
3886
+ }, {
3887
+ label: "I can't connect right now",
3888
+ value: "decline"
3889
+ }],
3890
+ onSelect: handleSelect
3891
+ })
3892
+ })
3893
+ ]
3894
+ })
3895
+ });
3896
+ };
3897
+ //#endregion
3698
3898
  //#region src/ui/tui/screens/audit/AuditIntroScreen.tsx
3699
3899
  const AuditIntroScreen = ({ store }) => {
3700
3900
  useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
@@ -5227,7 +5427,10 @@ const ExitScreen = () => {
5227
5427
  /**
5228
5428
  * AuthErrorScreen — Shown when the PostHog LLM Gateway returns a 401.
5229
5429
  *
5230
- * Two distinct causes:
5430
+ * Distinct causes, most specific first:
5431
+ * 0. The OAuth grant is gone — a pre-run refresh already got `invalid_grant`
5432
+ * from the token endpoint. The only branch backed by a server verdict
5433
+ * rather than inference, so it wins; re-running is the whole fix.
5231
5434
  * 1. Claude Code settings.json / managed-settings overrides ANTHROPIC_*
5232
5435
  * env vars — auth conflict. Tell the user to log out of Claude Code.
5233
5436
  * 2. The PostHog API key itself was rejected — bad prefix, missing scope,
@@ -5241,6 +5444,7 @@ const AuthErrorScreen = ({ store }) => {
5241
5444
  const conflicts = detail?.conflicts ?? [];
5242
5445
  const usingManagedLogin = detail?.usingManagedLogin ?? false;
5243
5446
  const credentialPlaces = detail?.credentialPlaces ?? [];
5447
+ const sessionExpired = detail?.sessionExpired ?? false;
5244
5448
  const logFilePath = detail?.logFilePath;
5245
5449
  return /* @__PURE__ */ jsxs(Box, {
5246
5450
  flexDirection: "column",
@@ -5251,7 +5455,36 @@ const AuthErrorScreen = ({ store }) => {
5251
5455
  bold: true,
5252
5456
  children: ["✘", " Authentication error"]
5253
5457
  }),
5254
- usingManagedLogin ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
5458
+ sessionExpired ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
5459
+ /* @__PURE__ */ jsx(Box, {
5460
+ flexDirection: "column",
5461
+ marginTop: 1,
5462
+ children: /* @__PURE__ */ jsx(Text, { children: "Your PostHog login expired while the wizard was running, so the LLM Gateway rejected it (401). Nothing on this machine is misconfigured — the session simply ran out." })
5463
+ }),
5464
+ /* @__PURE__ */ jsx(Box, {
5465
+ marginTop: 1,
5466
+ children: /* @__PURE__ */ jsx(Text, {
5467
+ dimColor: true,
5468
+ children: "Re-run the wizard and log in again:"
5469
+ })
5470
+ }),
5471
+ /* @__PURE__ */ jsx(Box, {
5472
+ flexDirection: "column",
5473
+ marginTop: 1,
5474
+ paddingLeft: 2,
5475
+ children: /* @__PURE__ */ jsx(Text, {
5476
+ color: "cyan",
5477
+ children: "npx @posthog/wizard"
5478
+ })
5479
+ }),
5480
+ /* @__PURE__ */ jsx(Box, {
5481
+ marginTop: 1,
5482
+ children: /* @__PURE__ */ jsx(Text, {
5483
+ dimColor: true,
5484
+ children: "Any files the agent already wrote are still in your project."
5485
+ })
5486
+ })
5487
+ ] }) : usingManagedLogin ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
5255
5488
  /* @__PURE__ */ jsx(Box, {
5256
5489
  flexDirection: "column",
5257
5490
  marginTop: 1,
@@ -5450,12 +5683,29 @@ const SessionTimeoutScreen = ({ store }) => {
5450
5683
  function handleAskKey(key, store) {
5451
5684
  if (key.escape) store.cancelPendingQuestion();
5452
5685
  }
5686
+ /**
5687
+ * Whether an answer would leave a required question effectively unanswered.
5688
+ *
5689
+ * The `wizard_ask` schema marks fields `required` (defaulting to true), but the
5690
+ * overlay used to submit whatever the input held — so pressing Enter on an empty
5691
+ * required credential field sent an empty string on to the agent. A blank host
5692
+ * or password is indistinguishable there from a real answer, so the warehouse
5693
+ * task ran on it, failed source creation, and dead-ended with no signal that the
5694
+ * user had in effect declined. Blocking the empty submit keeps the contract the
5695
+ * schema already advertises; Esc stays the way to skip. Optional fields
5696
+ * (`required === false`) are never blocked, and pickers always yield a value.
5697
+ */
5698
+ function isRequiredButEmpty(question, value) {
5699
+ if (question.required === false) return false;
5700
+ return Array.isArray(value) ? value.length === 0 : value.trim().length === 0;
5701
+ }
5453
5702
  const WizardAskScreen = ({ store }) => {
5454
5703
  useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
5455
5704
  const pending = store.session.pendingQuestion;
5456
5705
  const [index, setIndex] = useState(0);
5457
5706
  const [answers, setAnswers] = useState({});
5458
5707
  const [lastPendingId, setLastPendingId] = useState(null);
5708
+ const [requiredHint, setRequiredHint] = useState(false);
5459
5709
  const [linkStatus, setLinkStatus] = useState("idle");
5460
5710
  const richLinks = pending?.richLinks ?? false;
5461
5711
  const currentPrompt = pending?.questions[index]?.prompt ?? "";
@@ -5498,6 +5748,7 @@ const WizardAskScreen = ({ store }) => {
5498
5748
  setLastPendingId(pending.id);
5499
5749
  setIndex(0);
5500
5750
  setAnswers({});
5751
+ setRequiredHint(false);
5501
5752
  return null;
5502
5753
  }
5503
5754
  const question = pending.questions[index];
@@ -5505,6 +5756,11 @@ const WizardAskScreen = ({ store }) => {
5505
5756
  const total = pending.questions.length;
5506
5757
  const progress = total > 1 ? `Question ${index + 1} of ${total}` : null;
5507
5758
  const submit = (value) => {
5759
+ if (isRequiredButEmpty(question, value)) {
5760
+ setRequiredHint(true);
5761
+ return;
5762
+ }
5763
+ setRequiredHint(false);
5508
5764
  const next = {
5509
5765
  ...answers,
5510
5766
  [question.id]: value
@@ -5569,6 +5825,13 @@ const WizardAskScreen = ({ store }) => {
5569
5825
  onSubmit: submit
5570
5826
  }, `${pending.id}:${question.id}`)
5571
5827
  }),
5828
+ requiredHint && /* @__PURE__ */ jsx(Box, {
5829
+ marginTop: 1,
5830
+ children: /* @__PURE__ */ jsxs(Text, {
5831
+ color: Colors.accent,
5832
+ children: [Icons.warning, " This field is required — type an answer, or press ESC to skip."]
5833
+ })
5834
+ }),
5572
5835
  /* @__PURE__ */ jsx(Box, {
5573
5836
  marginTop: 1,
5574
5837
  children: /* @__PURE__ */ jsxs(Text, {
@@ -5764,7 +6027,7 @@ function createMcpSuggestedPromptsServices(store) {
5764
6027
  };
5765
6028
  }
5766
6029
  async function* runProductionPromptStreaming(args) {
5767
- const { runMcpPromptViaSdk } = await import("./mcp-prompt-streaming-DOHJxT8K.js");
6030
+ const { runMcpPromptViaSdk } = await import("./mcp-prompt-streaming-DRAK8CMP.js");
5768
6031
  yield* runMcpPromptViaSdk(args);
5769
6032
  }
5770
6033
  //#endregion
@@ -5799,6 +6062,7 @@ function createScreens(store, services) {
5799
6062
  ["self-driving-integration-check"]: /* @__PURE__ */ jsx(SelfDrivingIntegrationCheckScreen, { store }),
5800
6063
  ["self-driving-integration-detect"]: /* @__PURE__ */ jsx(SelfDrivingIntegrationDetectScreen, { store }),
5801
6064
  ["self-driving-handoff"]: /* @__PURE__ */ jsx(SelfDrivingHandoffScreen, { store }),
6065
+ ["self-driving-github"]: /* @__PURE__ */ jsx(SelfDrivingGitHubScreen, { store }),
5802
6066
  ["audit-intro"]: /* @__PURE__ */ jsx(AuditIntroScreen, { store }),
5803
6067
  ["audit-run"]: /* @__PURE__ */ jsx(AuditRunScreen, { store }),
5804
6068
  ["audit-outro"]: /* @__PURE__ */ jsx(AuditOutroScreen, { store }),
@@ -5957,4 +6221,4 @@ function startTUI(version, program = Program.PostHogIntegration) {
5957
6221
  //#endregion
5958
6222
  export { startTUI };
5959
6223
 
5960
- //# sourceMappingURL=start-tui-ebV_ynrs.js.map
6224
+ //# sourceMappingURL=start-tui-r4Spgptv.js.map