@posthog/wizard 2.83.0 → 2.84.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.
- package/README.md +1 -29
- package/dist/{PickerMenu-BGGeYqd-.js → PickerMenu-BtheKi1o.js} +1 -1
- package/dist/{PickerMenu-BGGeYqd-.js.map → PickerMenu-BtheKi1o.js.map} +1 -1
- package/dist/_dev-only-stub-B0db0Klc.js +1 -0
- package/dist/{agent-interface-fcDXqb-_.js → agent-interface-BNssNetq.js} +12 -12
- package/dist/agent-interface-BNssNetq.js.map +1 -0
- package/dist/{agent-prompt-loader-F9gGPMt0.js → agent-prompt-loader-iV11XVEF.js} +16 -8
- package/dist/agent-prompt-loader-iV11XVEF.js.map +1 -0
- package/dist/{analytics-GQv--mQm.js → analytics-Drox5LSW.js} +6 -5
- package/dist/analytics-Drox5LSW.js.map +1 -0
- package/dist/analytics-Ix9HEra3.js +2 -0
- package/dist/{api-WUOSLXPJ.js → api-Dfu655Qt.js} +2 -2
- package/dist/{api-WUOSLXPJ.js.map → api-Dfu655Qt.js.map} +1 -1
- package/dist/api-H2UaPgjv.js +2 -0
- package/dist/{api-key-login-tysMeZnR.js → api-key-login-BgwfAXfv.js} +5 -5
- package/dist/{api-key-login-tysMeZnR.js.map → api-key-login-BgwfAXfv.js.map} +1 -1
- package/dist/api-key-login-Cow3UDAN.js +2 -0
- package/dist/bin.js +1 -1
- package/dist/{bounded-fs-B31zq2ir.js → bounded-fs-TRL6IsoU.js} +32 -16
- package/dist/bounded-fs-TRL6IsoU.js.map +1 -0
- package/dist/{ci-install-CYSFbFXd.js → ci-install-nc1IKuX2.js} +6 -6
- package/dist/{ci-install-CYSFbFXd.js.map → ci-install-nc1IKuX2.js.map} +1 -1
- package/dist/{console-log-DJiTqYT2.js → console-log-BMhBoX-o.js} +2 -2
- package/dist/{console-log-DJiTqYT2.js.map → console-log-BMhBoX-o.js.map} +1 -1
- package/dist/{debug-BTUMatFI.js → debug-BfO_Txo8.js} +3 -3
- package/dist/debug-BfO_Txo8.js.map +1 -0
- package/dist/{defaults-DDVl3tKN.js → defaults-BWLIffh5.js} +1 -1
- package/dist/{defaults-DDVl3tKN.js.map → defaults-BWLIffh5.js.map} +1 -1
- package/dist/{errors-DhFeR8Sp.js → errors-BXlWujEw.js} +1 -1
- package/dist/{errors-DhFeR8Sp.js.map → errors-BXlWujEw.js.map} +1 -1
- package/dist/{family-picker-BKs-tTyu.js → family-picker-CAW_VtYf.js} +2 -2
- package/dist/{family-picker-BKs-tTyu.js.map → family-picker-CAW_VtYf.js.map} +1 -1
- package/dist/{gateway-CJ8Jqbll.js → gateway-CLQQb96F.js} +25 -9
- package/dist/{gateway-CJ8Jqbll.js.map → gateway-CLQQb96F.js.map} +1 -1
- package/dist/headless-CHGNEzO3.js +3 -0
- package/dist/{headless-le-QqOuj.js → headless-DMO8N_FD.js} +2 -2
- package/dist/{headless-le-QqOuj.js.map → headless-DMO8N_FD.js.map} +1 -1
- package/dist/{host-resolution-Cht8bL39.js → host-resolution-DftfSjJD.js} +4 -4
- package/dist/{host-resolution-Cht8bL39.js.map → host-resolution-DftfSjJD.js.map} +1 -1
- package/dist/{install-BhnFP3p3.js → install-C9FPM37m.js} +6 -6
- package/dist/{install-BhnFP3p3.js.map → install-C9FPM37m.js.map} +1 -1
- package/dist/{install-55JbRsO-.js → install-MWoo1hXL.js} +1 -1
- package/dist/{interactive-9qRL8259.js → interactive-DOnolJHB.js} +3 -3
- package/dist/{interactive-9qRL8259.js.map → interactive-DOnolJHB.js.map} +1 -1
- package/dist/{links-5Blqk4Im.js → links-CatXPRxH.js} +3 -3
- package/dist/{links-5Blqk4Im.js.map → links-CatXPRxH.js.map} +1 -1
- package/dist/{main-CUIcozEG.js → main-CINmZtoW.js} +23 -23
- package/dist/{main-CUIcozEG.js.map → main-CINmZtoW.js.map} +1 -1
- package/dist/{mcp-D73aCOHK.js → mcp-KVV6Z_bq.js} +3 -3
- package/dist/{mcp-D73aCOHK.js.map → mcp-KVV6Z_bq.js.map} +1 -1
- package/dist/{mcp-prompt-streaming-B5lIQ0l1.js → mcp-prompt-streaming-M6UnLgGX.js} +5 -5
- package/dist/{mcp-prompt-streaming-B5lIQ0l1.js.map → mcp-prompt-streaming-M6UnLgGX.js.map} +1 -1
- package/dist/{mode-label-DB3ol_sj.js → mode-label--bJuXny5.js} +1 -1
- package/dist/{mode-label-DB3ol_sj.js.map → mode-label--bJuXny5.js.map} +1 -1
- package/dist/{models-CLTglHFZ.js → models-B0huHItG.js} +2 -2
- package/dist/{models-CLTglHFZ.js.map → models-B0huHItG.js.map} +1 -1
- package/dist/{non-interactive-DkldwWDM.js → non-interactive-DiEu4_6l.js} +3 -3
- package/dist/{non-interactive-DkldwWDM.js.map → non-interactive-DiEu4_6l.js.map} +1 -1
- package/dist/{oauth-session-CfkZ339p.js → oauth-session-9EU3ky0v.js} +2 -2
- package/dist/{oauth-session-CfkZ339p.js.map → oauth-session-9EU3ky0v.js.map} +1 -1
- package/dist/{orchestrator-tools-lvNVQhzs.js → orchestrator-tools-QWyDLu_7.js} +3 -3
- package/dist/{orchestrator-tools-lvNVQhzs.js.map → orchestrator-tools-QWyDLu_7.js.map} +1 -1
- package/dist/package-json-BAtJRHSq.js +2 -0
- package/dist/{package-json-2UrhE6kP.js → package-json-z1agAYXs.js} +1 -1
- package/dist/{package-json-2UrhE6kP.js.map → package-json-z1agAYXs.js.map} +1 -1
- package/dist/{package-manager-BqRNp5y_.js → package-manager-B-9I_fAT.js} +4 -4
- package/dist/{package-manager-BqRNp5y_.js.map → package-manager-B-9I_fAT.js.map} +1 -1
- package/dist/{pi-2pYz2OY3.js → pi-BSnSk6rv.js} +19 -20
- package/dist/pi-BSnSk6rv.js.map +1 -0
- package/dist/{playground-jxZNxRwC.js → playground-Drz1qszs.js} +4 -4
- package/dist/{playground-jxZNxRwC.js.map → playground-Drz1qszs.js.map} +1 -1
- package/dist/{posthog-integration-DxRkw5DI.js → posthog-integration-mIQGBc1f.js} +882 -2512
- package/dist/posthog-integration-mIQGBc1f.js.map +1 -0
- package/dist/programs-Bv0_YHzE.js +3 -0
- package/dist/{programs-eTv2T2rs.js → programs-mxhRXwP-.js} +194 -88
- package/dist/programs-mxhRXwP-.js.map +1 -0
- package/dist/provisioning-BVsxSNve.js +2 -0
- package/dist/{provisioning-c5JJ30KX.js → provisioning-CHUjae9V.js} +4 -4
- package/dist/{provisioning-c5JJ30KX.js.map → provisioning-CHUjae9V.js.map} +1 -1
- package/dist/{queue-tools-10w8lhEs.js → queue-tools-PFG6H93Q.js} +4 -4
- package/dist/{queue-tools-10w8lhEs.js.map → queue-tools-PFG6H93Q.js.map} +1 -1
- package/dist/{results-C45prSKD.js → results-5yCKf2cI.js} +2 -2
- package/dist/{results-C45prSKD.js.map → results-5yCKf2cI.js.map} +1 -1
- package/dist/{run-jugssomh.js → run-D5TKJuSL.js} +10 -10
- package/dist/{run-jugssomh.js.map → run-D5TKJuSL.js.map} +1 -1
- package/dist/{run-CM24OgPF.js → run-W03b6jNM.js} +12 -12
- package/dist/{run-CM24OgPF.js.map → run-W03b6jNM.js.map} +1 -1
- package/dist/{run-tool-DZrZFoGq.js → run-tool-DTQF8mmI.js} +17 -17
- package/dist/{run-tool-DZrZFoGq.js.map → run-tool-DTQF8mmI.js.map} +1 -1
- package/dist/run-tool-DjERhu7G.js +2 -0
- package/dist/{runners-CoIYt0iI.js → runners-B_84kPyf.js} +11 -11
- package/dist/{runners-CoIYt0iI.js.map → runners-B_84kPyf.js.map} +1 -1
- package/dist/{security-ppK2MwCn.js → security-pApVawYb.js} +5 -5
- package/dist/{security-ppK2MwCn.js.map → security-pApVawYb.js.map} +1 -1
- package/dist/{setup-utils-B5E1rXLa.js → setup-utils-CQY8PHjR.js} +3 -3
- package/dist/{setup-utils-B5E1rXLa.js.map → setup-utils-CQY8PHjR.js.map} +1 -1
- package/dist/{start-playground-DujiUNFT.js → start-playground-DAw1GbLt.js} +8 -8
- package/dist/{start-playground-DujiUNFT.js.map → start-playground-DAw1GbLt.js.map} +1 -1
- package/dist/{subagent-BdDWA8j5.js → subagent-YLGSvgoZ.js} +4 -4
- package/dist/subagent-YLGSvgoZ.js.map +1 -0
- package/dist/{task-Y8lWoDE7.js → task-3hRSovmK.js} +19 -20
- package/dist/task-3hRSovmK.js.map +1 -0
- package/dist/{tasks-BfJhVky2.js → tasks-C03QbXTx.js} +1 -1
- package/dist/{tasks-BfJhVky2.js.map → tasks-C03QbXTx.js.map} +1 -1
- package/dist/{telemetry-Cwqf0iur.js → telemetry-BPBzqsb_.js} +2 -2
- package/dist/{telemetry-Cwqf0iur.js.map → telemetry-BPBzqsb_.js.map} +1 -1
- package/dist/{terminal-BLL-X6YP.js → terminal-DZsYFbm9.js} +92 -63
- package/dist/terminal-DZsYFbm9.js.map +1 -0
- package/dist/{tools-C8k90ISV.js → tools-D_AtrhbO.js} +15 -15
- package/dist/{tools-C8k90ISV.js.map → tools-D_AtrhbO.js.map} +1 -1
- package/dist/{tools-g42e5kJz.js → tools-DyzRi_dQ.js} +8 -8
- package/dist/{tools-g42e5kJz.js.map → tools-DyzRi_dQ.js.map} +1 -1
- package/dist/{tui-CBnRWnrm.js → tui-CRp0iCuT.js} +5 -5
- package/dist/{tui-CBnRWnrm.js.map → tui-CRp0iCuT.js.map} +1 -1
- package/dist/{tui-BPWJ-J-k.js → tui-UI6ctBQJ.js} +1 -1
- package/dist/{upload-step-CFoxwd5t.js → upload-step-DrYXnpzI.js} +3 -3
- package/dist/{upload-step-CFoxwd5t.js.map → upload-step-DrYXnpzI.js.map} +1 -1
- package/dist/{urls-BTZhm5eA.js → urls-WeqfBLP4.js} +2 -2
- package/dist/{urls-BTZhm5eA.js.map → urls-WeqfBLP4.js.map} +1 -1
- package/dist/{wizard-abort-HtpiSsQO.js → wizard-abort-BwEefm6P.js} +5 -5
- package/dist/{wizard-abort-HtpiSsQO.js.map → wizard-abort-BwEefm6P.js.map} +1 -1
- package/dist/yara-hooks-MDtFbuoM.js +2 -0
- package/dist/{yara-hooks-BPYhN9WM.js → yara-hooks-aDbdsitJ.js} +41 -5
- package/dist/{yara-hooks-BPYhN9WM.js.map → yara-hooks-aDbdsitJ.js.map} +1 -1
- package/package.json +9 -7
- package/dist/agent-interface-fcDXqb-_.js.map +0 -1
- package/dist/agent-prompt-loader-F9gGPMt0.js.map +0 -1
- package/dist/analytics-C9QnGvuc.js +0 -2
- package/dist/analytics-GQv--mQm.js.map +0 -1
- package/dist/api-CsXfZKkq.js +0 -2
- package/dist/api-key-login-CDSxsYtP.js +0 -2
- package/dist/bounded-fs-B31zq2ir.js.map +0 -1
- package/dist/debug-BTUMatFI.js.map +0 -1
- package/dist/headless-DZ3mq07K.js +0 -3
- package/dist/package-json-Dblip2_X.js +0 -2
- package/dist/pi-2pYz2OY3.js.map +0 -1
- package/dist/posthog-integration-DxRkw5DI.js.map +0 -1
- package/dist/programs-D2793-PK.js +0 -3
- package/dist/programs-eTv2T2rs.js.map +0 -1
- package/dist/provisioning-CtQ0GEHa.js +0 -2
- package/dist/run-tool-BZFgFb_2.js +0 -2
- package/dist/subagent-BdDWA8j5.js.map +0 -1
- package/dist/task-Y8lWoDE7.js.map +0 -1
- package/dist/terminal-BLL-X6YP.js.map +0 -1
- package/dist/yara-hooks-BwhEDXIt.js +0 -2
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { n as ErrorCodes } from "./emit-BqLCdV8Y.js";
|
|
2
|
-
import { f as VERSION, l as WIZARD_TASK_STREAM_FILE, o as logToFile, p as HEADLESS_FLAG } from "./debug-
|
|
3
|
-
import {
|
|
4
|
-
import { a as WizardError, n as sanitizeErrorDetail, t as classifyRunFailure } from "./errors-
|
|
5
|
-
import { i as readProjectFile, t as IGNORED_DIRS } from "./bounded-fs-
|
|
6
|
-
import { n as isUsingTypeScript } from "./setup-utils-
|
|
7
|
-
import { l as markGrantRevoked, r as currentCredentials, s as rotateAfterUnauthorized, t as configureOAuthSession } from "./oauth-session-
|
|
8
|
-
import {
|
|
9
|
-
import { R as WIZARD_TOOL_NAMES, c as checkAllSettingsConflicts, d as restoreClaudeSettings, l as classifySettingsConflicts, nt as LONGER_ASK_TIMEOUT_MS, p as registerCleanup, s as backupAndFixClaudeSettings } from "./agent-interface-
|
|
10
|
-
import { a as getOAuthUrl, s as resolveBaseUrl } from "./urls-
|
|
11
|
-
import {
|
|
12
|
-
import { m as appendStatus } from "./pi-
|
|
13
|
-
import { y as writeJsonAtomic } from "./queue-tools-
|
|
14
|
-
import { C as
|
|
15
|
-
import { t as resolveApiKeyProject } from "./api-key-login-
|
|
2
|
+
import { f as VERSION, l as WIZARD_TASK_STREAM_FILE, o as logToFile, p as HEADLESS_FLAG } from "./debug-BfO_Txo8.js";
|
|
3
|
+
import { C as GPT5_6_TERRA_MODEL, H as REPLAY_VISION_SUPPORTED, N as POSTHOG_DEV_CLIENT_ID, O as ISSUES_URL, P as POSTHOG_DOCS_URL, R as POSTHOG_PROXY_CLIENT_ID, X as WIZARD_OAUTH_SCOPES, at as getSkillsBaseUrl, et as WIZARD_PROVISIONING_SCOPES, g as EVENTS_AUDIT_REPORT_FILE, it as WIZARD_USER_AGENT, n as analytics, o as mayReportScanResults, p as DEFAULT_AGENT_MODEL, pt as resolveLocalDev, q as WIZARD_CONTACT_EMAIL, r as groupsFromUser, w as GPT6_SOL_MODEL, z as POSTHOG_STATUS_PAGE_URL } from "./analytics-Drox5LSW.js";
|
|
4
|
+
import { a as WizardError, n as sanitizeErrorDetail, t as classifyRunFailure } from "./errors-BXlWujEw.js";
|
|
5
|
+
import { i as readProjectFile, t as IGNORED_DIRS } from "./bounded-fs-TRL6IsoU.js";
|
|
6
|
+
import { n as isUsingTypeScript } from "./setup-utils-CQY8PHjR.js";
|
|
7
|
+
import { l as markGrantRevoked, r as currentCredentials, s as rotateAfterUnauthorized, t as configureOAuthSession } from "./oauth-session-9EU3ky0v.js";
|
|
8
|
+
import { c as AgentSignals, g as checkSkillsOriginHealth } from "./gateway-CLQQb96F.js";
|
|
9
|
+
import { R as WIZARD_TOOL_NAMES, c as checkAllSettingsConflicts, d as restoreClaudeSettings, l as classifySettingsConflicts, nt as LONGER_ASK_TIMEOUT_MS, p as registerCleanup, s as backupAndFixClaudeSettings } from "./agent-interface-BNssNetq.js";
|
|
10
|
+
import { a as getOAuthUrl, s as resolveBaseUrl } from "./urls-WeqfBLP4.js";
|
|
11
|
+
import { D as FRAMEWORK_REGISTRY, E as detectFramework, M as DEFAULT_BINDING, O as SPINNER_MESSAGE, S as tagScanResults, T as gatherFrameworkContext, _ as scopeInstallDirToProject, a as detectPostHogIntegration, b as resolveProjectDir, d as scanCodebaseFor, f as scannedWarehouseSources, g as detectIntegrationProjects, h as workspaceFingerprint, i as ProgramAbort, j as runAgent, l as findPackageJsons, m as getDetectedWarehouseSources, n as WAREHOUSE_SOURCE_SCOPE_ADDITIONS, o as reportWarehouseSourcesDetected, p as DETECTED_WAREHOUSE_SOURCES_KEY, r as abortNoFrameworkDetected, t as config$14, u as getCodebaseScan, v as toIntegrationCandidates, w as noteDetectedFramework, x as applyScanTags, y as detectProjectsWithAgent } from "./posthog-integration-mIQGBc1f.js";
|
|
12
|
+
import { m as appendStatus } from "./pi-BSnSk6rv.js";
|
|
13
|
+
import { y as writeJsonAtomic } from "./queue-tools-PFG6H93Q.js";
|
|
14
|
+
import { C as AUDIT_REPORT_FILE, S as AUDIT_CHECKS_FILE, w as coerceAuditChecks } from "./yara-hooks-aDbdsitJ.js";
|
|
15
|
+
import { t as resolveApiKeyProject } from "./api-key-login-BgwfAXfv.js";
|
|
16
16
|
import { valid } from "semver";
|
|
17
17
|
import * as fs$1 from "fs";
|
|
18
18
|
import fs, { existsSync, readFileSync, readdirSync, statSync } from "fs";
|
|
@@ -248,20 +248,23 @@ const MCP_ANALYTICS_ABORT_CASES = [
|
|
|
248
248
|
* 'mcp-analytics'` from context-mill — a deliberate breaking change, done then,
|
|
249
249
|
* not pre-emptively.
|
|
250
250
|
*/
|
|
251
|
-
const config$13 =
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
251
|
+
const config$13 = {
|
|
252
|
+
decisions: ["is_mcp_server"],
|
|
253
|
+
...createSkillProgram({
|
|
254
|
+
skillId: "mcp-analytics",
|
|
255
|
+
command: "mcp-analytics",
|
|
256
|
+
id: "mcp-analytics",
|
|
257
|
+
description: "Add PostHog MCP Analytics to your MCP server",
|
|
258
|
+
integrationLabel: "mcp-analytics",
|
|
259
|
+
customPrompt: `Instrument this project's MCP server with PostHog MCP analytics. Run the \`mcp-analytics\` skill end-to-end: detect the language and server style, install the PostHog MCP SDK for that language (\`@posthog/mcp\` for TypeScript, \`posthog\` for Python, \`posthogmcpsdk\` for Go, \`posthog-ruby\` for Ruby), wrap the server (or use the custom-dispatcher client where the skill says so), wire the project API key and host, and verify. Make only additive changes — do not alter tool behavior. For a Ruby server, the report must open by saying the Ruby SDK is experimental and not officially supported. The final report is written to ./${MCP_ANALYTICS_REPORT_FILE}.`,
|
|
260
|
+
successMessage: `MCP analytics configured! View the report at ./${MCP_ANALYTICS_REPORT_FILE}`,
|
|
261
|
+
reportFile: MCP_ANALYTICS_REPORT_FILE,
|
|
262
|
+
docsUrl: "https://posthog.com/docs/mcp-analytics",
|
|
263
|
+
spinnerMessage: "Setting up MCP analytics...",
|
|
264
|
+
estimatedDurationMinutes: 5,
|
|
265
|
+
abortCases: MCP_ANALYTICS_ABORT_CASES
|
|
266
|
+
})
|
|
267
|
+
};
|
|
265
268
|
//#endregion
|
|
266
269
|
//#region src/programs/replay-vision/scopes.ts
|
|
267
270
|
/**
|
|
@@ -357,6 +360,11 @@ async function detectReplayVisionProject(ctx) {
|
|
|
357
360
|
* headless equivalent of `onReady`.
|
|
358
361
|
*/
|
|
359
362
|
const config$12 = {
|
|
363
|
+
decisions: [
|
|
364
|
+
"framework",
|
|
365
|
+
"web_frontend",
|
|
366
|
+
"primary_user_flow"
|
|
367
|
+
],
|
|
360
368
|
...createSkillProgram({
|
|
361
369
|
skillId: "replay-vision-setup",
|
|
362
370
|
command: "replay-vision",
|
|
@@ -415,6 +423,7 @@ const AI_OBSERVABILITY_REPORT_FILE = "posthog-ai-observability-report.md";
|
|
|
415
423
|
* "add AIO to a project" flow is the only action.
|
|
416
424
|
*/
|
|
417
425
|
const config$11 = {
|
|
426
|
+
decisions: ["calls_llm_api"],
|
|
418
427
|
binding: {
|
|
419
428
|
sequence: "linear",
|
|
420
429
|
harness: "pi",
|
|
@@ -1267,6 +1276,7 @@ function detectRevenuePrerequisites(session, setFrameworkContext) {
|
|
|
1267
1276
|
//#endregion
|
|
1268
1277
|
//#region src/programs/revenue-analytics/index.ts
|
|
1269
1278
|
const config$6 = {
|
|
1279
|
+
decisions: ["billing_code"],
|
|
1270
1280
|
command: "revenue-analytics",
|
|
1271
1281
|
description: "Set up PostHog for Revenue Analytics",
|
|
1272
1282
|
id: "revenue-analytics-setup",
|
|
@@ -1292,7 +1302,7 @@ const config$6 = {
|
|
|
1292
1302
|
/**
|
|
1293
1303
|
* Warehouse-source program detection step.
|
|
1294
1304
|
*
|
|
1295
|
-
*
|
|
1305
|
+
* Reads the run's codebase scan and writes a `detectError` into
|
|
1296
1306
|
* frameworkContext for the intro screen, plus the `[ABORT]` cases the
|
|
1297
1307
|
* data-warehouse-source-setup skill can emit.
|
|
1298
1308
|
*/
|
|
@@ -1309,10 +1319,10 @@ const WAREHOUSE_ABORT_CASES = [{
|
|
|
1309
1319
|
docsUrl: "https://posthog.com/docs/data-warehouse"
|
|
1310
1320
|
}];
|
|
1311
1321
|
/**
|
|
1312
|
-
*
|
|
1313
|
-
*
|
|
1322
|
+
* Check the run's codebase scan for warehouse sources. Writes a `detectError`
|
|
1323
|
+
* into frameworkContext for the intro screen when there is nothing to set up.
|
|
1314
1324
|
*/
|
|
1315
|
-
function detectWarehousePrerequisites(session, setFrameworkContext) {
|
|
1325
|
+
async function detectWarehousePrerequisites(session, setFrameworkContext) {
|
|
1316
1326
|
const fail = (error) => setFrameworkContext("detectError", error);
|
|
1317
1327
|
const installDir = session.installDir;
|
|
1318
1328
|
if (!existsSync(installDir)) {
|
|
@@ -1344,14 +1354,16 @@ function detectWarehousePrerequisites(session, setFrameworkContext) {
|
|
|
1344
1354
|
});
|
|
1345
1355
|
return;
|
|
1346
1356
|
}
|
|
1347
|
-
const sources =
|
|
1357
|
+
const sources = await scannedWarehouseSources(session);
|
|
1348
1358
|
if (sources.length === 0) {
|
|
1349
1359
|
fail({ kind: "no-sources" });
|
|
1350
1360
|
return;
|
|
1351
1361
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1362
|
+
tagScanResults(session, setFrameworkContext, {
|
|
1363
|
+
warehouse_source_kinds: sources.map((s) => s.kind).join(","),
|
|
1364
|
+
warehouse_source_modes: sources.map((s) => `${s.kind}:${s.mode}`).join(","),
|
|
1365
|
+
warehouse_source_count: sources.length
|
|
1366
|
+
});
|
|
1355
1367
|
setFrameworkContext(DETECTED_WAREHOUSE_SOURCES_KEY, sources);
|
|
1356
1368
|
}
|
|
1357
1369
|
//#endregion
|
|
@@ -1375,10 +1387,12 @@ function buildPrompt(session) {
|
|
|
1375
1387
|
].join("\n");
|
|
1376
1388
|
}
|
|
1377
1389
|
const config$5 = {
|
|
1390
|
+
decisions: ["owns_database"],
|
|
1378
1391
|
command: "warehouse",
|
|
1379
1392
|
description: "Detect and connect Data Warehouse sources",
|
|
1380
1393
|
id: "warehouse-source",
|
|
1381
1394
|
skillId: "data-warehouse-source-setup",
|
|
1395
|
+
scansCodebase: true,
|
|
1382
1396
|
onReady: (ctx) => detectWarehousePrerequisites(ctx.session, ctx.setFrameworkContext),
|
|
1383
1397
|
oauthScopeAdditions: WAREHOUSE_SOURCE_SCOPE_ADDITIONS,
|
|
1384
1398
|
healthCheck: false,
|
|
@@ -1585,6 +1599,11 @@ const SELF_DRIVING_ABORT_CASES = [
|
|
|
1585
1599
|
message: "Interactive terminal required",
|
|
1586
1600
|
body: "Self-driving setup asks questions along the way (GitHub and issue trackers), so it needs an interactive terminal. Run the wizard outside CI / non-interactive mode."
|
|
1587
1601
|
},
|
|
1602
|
+
{
|
|
1603
|
+
match: /^wrong-project$/i,
|
|
1604
|
+
message: "This repo uses a different PostHog project",
|
|
1605
|
+
body: "Nothing was changed. Run the wizard again with --project-id set to the project this repo sends events to. The id is the number after /project/ in that project's PostHog URL."
|
|
1606
|
+
},
|
|
1588
1607
|
{
|
|
1589
1608
|
match: /^requirements-incomplete$/i,
|
|
1590
1609
|
message: "Setup needs your input",
|
|
@@ -1596,7 +1615,7 @@ const SELF_DRIVING_ABORT_CASES = [
|
|
|
1596
1615
|
* `SelfDrivingDetectError` to frameworkContext on failure — the intro
|
|
1597
1616
|
* screen renders it and blocks.
|
|
1598
1617
|
*/
|
|
1599
|
-
function detectSelfDrivingPrerequisites(session, setFrameworkContext) {
|
|
1618
|
+
async function detectSelfDrivingPrerequisites(session, setFrameworkContext) {
|
|
1600
1619
|
const fail = (error) => setFrameworkContext("detectError", error);
|
|
1601
1620
|
const installDir = session.installDir;
|
|
1602
1621
|
if (!existsSync(installDir)) {
|
|
@@ -1625,9 +1644,9 @@ function detectSelfDrivingPrerequisites(session, setFrameworkContext) {
|
|
|
1625
1644
|
return;
|
|
1626
1645
|
}
|
|
1627
1646
|
setFrameworkContext(POSTHOG_PRESENT_KEY, detectPostHogPresent(installDir));
|
|
1628
|
-
detectConnectedTools(
|
|
1647
|
+
await detectConnectedTools(session, setFrameworkContext);
|
|
1629
1648
|
}
|
|
1630
|
-
/** Step 5's ask options intersected with
|
|
1649
|
+
/** Step 5's ask options intersected with the tool catalog's kinds. Reconcile when the skill's catalog grows. */
|
|
1631
1650
|
const SELF_DRIVING_TOOL_KINDS = new Set([
|
|
1632
1651
|
"Github",
|
|
1633
1652
|
"GitLab",
|
|
@@ -1651,18 +1670,21 @@ const SELF_DRIVING_TOOL_KINDS = new Set([
|
|
|
1651
1670
|
"Productboard",
|
|
1652
1671
|
"GoogleSearchConsole"
|
|
1653
1672
|
]);
|
|
1654
|
-
/**
|
|
1655
|
-
function detectConnectedTools(
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
setFrameworkContext(SELF_DRIVING_DETECTED_TOOLS_KEY, tools);
|
|
1662
|
-
} catch (error) {
|
|
1663
|
-
analytics.setTag("connected_tools_detected_count", -1);
|
|
1664
|
-
analytics.captureException(error instanceof Error ? error : new Error(String(error)), { step: "detectConnectedTools" });
|
|
1673
|
+
/** Pick the inbox-connectable tools out of the run's codebase scan so STEP 5 can surface them first. */
|
|
1674
|
+
async function detectConnectedTools(session, setFrameworkContext) {
|
|
1675
|
+
const scan = getCodebaseScan(session);
|
|
1676
|
+
if (!scan) return;
|
|
1677
|
+
if (scan.failed) {
|
|
1678
|
+
tagScanResults(session, setFrameworkContext, { connected_tools_detected_count: -1 });
|
|
1679
|
+
return;
|
|
1665
1680
|
}
|
|
1681
|
+
const tools = (await scannedWarehouseSources(session)).filter((s) => SELF_DRIVING_TOOL_KINDS.has(s.kind));
|
|
1682
|
+
tagScanResults(session, setFrameworkContext, {
|
|
1683
|
+
connected_tools_detected_count: tools.length,
|
|
1684
|
+
...tools.length > 0 && { connected_tools_detected: tools.map((s) => s.kind).join(",") }
|
|
1685
|
+
});
|
|
1686
|
+
if (tools.length === 0) return;
|
|
1687
|
+
setFrameworkContext(SELF_DRIVING_DETECTED_TOOLS_KEY, tools);
|
|
1666
1688
|
}
|
|
1667
1689
|
//#endregion
|
|
1668
1690
|
//#region src/programs/self-driving/prompt.ts
|
|
@@ -1776,6 +1798,19 @@ STEP 1 — Check Self-driving access. (skill: "Check access")
|
|
|
1776
1798
|
and halt.
|
|
1777
1799
|
|
|
1778
1800
|
STEP 2 — Read project and current Signals state. (skill: "Read context")
|
|
1801
|
+
First confirm that this repo sends events to project ${ctx.projectId}.
|
|
1802
|
+
The user picked that project on the PostHog login screen, and that
|
|
1803
|
+
screen preselects the last project they opened in the browser, so it
|
|
1804
|
+
can be the wrong one. Find the project token in this repo's PostHog
|
|
1805
|
+
client setup (the init call, its env var, and that env var's value in
|
|
1806
|
+
any .env file). This project's token is ${ctx.projectApiKey}. If the
|
|
1807
|
+
repo's token is a different phc_ token, STOP before any write and ask
|
|
1808
|
+
ONE wizard_ask: continue with project ${ctx.projectId}, or stop so they
|
|
1809
|
+
can run the wizard again for the repo's project. Say which token the
|
|
1810
|
+
repo uses and where. If they stop, emit
|
|
1811
|
+
${AgentSignals.ABORT} wrong-project
|
|
1812
|
+
and halt. If the tokens match, or the repo has no literal token, go on.
|
|
1813
|
+
|
|
1779
1814
|
If ./posthog-setup-report.md exists, read it as a strong hint for what
|
|
1780
1815
|
THIS repo instruments — but it is often absent (users frequently don't
|
|
1781
1816
|
commit it), so do NOT depend on it. Combine whatever you find with the
|
|
@@ -2137,6 +2172,7 @@ const buildRun = (session) => Promise.resolve({
|
|
|
2137
2172
|
}
|
|
2138
2173
|
});
|
|
2139
2174
|
const config$4 = {
|
|
2175
|
+
decisions: ["primary_user_flow", "user_login"],
|
|
2140
2176
|
...createSkillProgram({
|
|
2141
2177
|
skillId: SELF_DRIVING_SKILL_ID,
|
|
2142
2178
|
command: "self-driving",
|
|
@@ -2151,6 +2187,7 @@ const config$4 = {
|
|
|
2151
2187
|
requires: ["posthog-integration"],
|
|
2152
2188
|
abortCases: SELF_DRIVING_ABORT_CASES
|
|
2153
2189
|
}),
|
|
2190
|
+
scansCodebase: true,
|
|
2154
2191
|
onReady: (ctx) => detectSelfDrivingPrerequisites(ctx.session, ctx.setFrameworkContext),
|
|
2155
2192
|
oauthScopeAdditions: SELF_DRIVING_SCOPE_ADDITIONS,
|
|
2156
2193
|
runSteps: { "integrate-run": {
|
|
@@ -2720,6 +2757,11 @@ function ensurePostHogCli(variant, log) {
|
|
|
2720
2757
|
preinstallPostHogCliOnce("source maps posthog-cli preinstall failed", { variant }, log);
|
|
2721
2758
|
}
|
|
2722
2759
|
const config$3 = {
|
|
2760
|
+
decisions: [
|
|
2761
|
+
"ships_minified_js",
|
|
2762
|
+
"build_tool",
|
|
2763
|
+
"deploy_platform"
|
|
2764
|
+
],
|
|
2723
2765
|
command: "upload-source-maps",
|
|
2724
2766
|
description: "Upload source maps to PostHog Error Tracking",
|
|
2725
2767
|
id: "error-tracking-upload-source-maps",
|
|
@@ -2932,6 +2974,7 @@ const ERROR_TRACKING_RUN = {
|
|
|
2932
2974
|
* of the project picker.
|
|
2933
2975
|
*/
|
|
2934
2976
|
const config$2 = {
|
|
2977
|
+
decisions: ["web_frontend", "server_runtime"],
|
|
2935
2978
|
binding: {
|
|
2936
2979
|
sequence: "orchestrator",
|
|
2937
2980
|
harness: "pi",
|
|
@@ -3118,7 +3161,6 @@ function getSubcommandPrograms() {
|
|
|
3118
3161
|
function getCommandPath(config) {
|
|
3119
3162
|
return config.parentCommand ? `${config.parentCommand} ${config.command}` : config.command;
|
|
3120
3163
|
}
|
|
3121
|
-
/** The program with this id, or undefined for a tool's id or none. */
|
|
3122
3164
|
function findProgramConfig(programId) {
|
|
3123
3165
|
return programId ? PROGRAM_REGISTRY.find((c) => c.id === programId) : void 0;
|
|
3124
3166
|
}
|
|
@@ -3139,6 +3181,45 @@ function getProvisioningScopesForProgram(programId) {
|
|
|
3139
3181
|
return withScopeAdditions(WIZARD_PROVISIONING_SCOPES, findProgramConfig(programId)?.oauthScopeAdditions);
|
|
3140
3182
|
}
|
|
3141
3183
|
//#endregion
|
|
3184
|
+
//#region src/programs/codebase-scan/report.ts
|
|
3185
|
+
/**
|
|
3186
|
+
* The one place a codebase scan is cleared to leave the machine. Runs only
|
|
3187
|
+
* when the user granted sharing (CI and headless runs grant it) and telemetry
|
|
3188
|
+
* is on.
|
|
3189
|
+
*
|
|
3190
|
+
* Called when consent resolves (the intro's Continue) and again after login,
|
|
3191
|
+
* because either can happen first. Each part latches, so a run reports once:
|
|
3192
|
+
* - the `warehouse sources detected` event, which needs no login
|
|
3193
|
+
* - the scan, which needs the login for its fingerprint. This hands it to
|
|
3194
|
+
* the task stream, which attaches it to the run's wizard session.
|
|
3195
|
+
*/
|
|
3196
|
+
function buildScanReport(scan, projectId) {
|
|
3197
|
+
return {
|
|
3198
|
+
program: scan.program,
|
|
3199
|
+
wizard_version: VERSION,
|
|
3200
|
+
workspace_fingerprint: workspaceFingerprint(projectId, scan.scannedDir),
|
|
3201
|
+
scanned_at: scan.scannedAt,
|
|
3202
|
+
complete: scan.complete,
|
|
3203
|
+
tools: scan.tools.map((tool) => ({
|
|
3204
|
+
kind: tool.kind,
|
|
3205
|
+
signals: tool.signals
|
|
3206
|
+
}))
|
|
3207
|
+
};
|
|
3208
|
+
}
|
|
3209
|
+
function reportCodebaseScan(store) {
|
|
3210
|
+
const { session } = store;
|
|
3211
|
+
if (session.noTelemetry) return;
|
|
3212
|
+
applyScanTags(session);
|
|
3213
|
+
store.markWarehouseSourcesReportedIfNeeded();
|
|
3214
|
+
if (!mayReportScanResults(session)) return;
|
|
3215
|
+
const { credentials } = session;
|
|
3216
|
+
if (!credentials) return;
|
|
3217
|
+
if (session.codebaseScanReport) return;
|
|
3218
|
+
const scan = getCodebaseScan(session);
|
|
3219
|
+
if (!scan || scan.failed) return;
|
|
3220
|
+
store.shareCodebaseScan(buildScanReport(scan, credentials.projectId));
|
|
3221
|
+
}
|
|
3222
|
+
//#endregion
|
|
3142
3223
|
//#region src/programs/detect-map.ts
|
|
3143
3224
|
const DETECT_CODES = {
|
|
3144
3225
|
"bad-directory": ErrorCodes.DetectBadDirectory,
|
|
@@ -3169,6 +3250,7 @@ function detectErrorCode(kind) {
|
|
|
3169
3250
|
* when it has one, anything else its `onReady`. Marks detection complete.
|
|
3170
3251
|
*/
|
|
3171
3252
|
async function detectProgram(config, store, runner) {
|
|
3253
|
+
await scanCodebaseFor(config, store.readyContext());
|
|
3172
3254
|
const ciPreRun = config.ciPreRun;
|
|
3173
3255
|
if (store.session.ci && ciPreRun) await store.edit((draft) => ciPreRun(draft, {
|
|
3174
3256
|
...runner,
|
|
@@ -3735,9 +3817,10 @@ var SessionStore = class {
|
|
|
3735
3817
|
markWarehouseSourcesReportedIfNeeded() {
|
|
3736
3818
|
if (reportWarehouseSourcesDetected(this.session)) this.set("warehouseSourcesReported", true);
|
|
3737
3819
|
}
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
this.
|
|
3820
|
+
/** Hand the scan to the task stream. First one wins: a run shares one scan. */
|
|
3821
|
+
shareCodebaseScan(report) {
|
|
3822
|
+
if (this.session.codebaseScanReport) return;
|
|
3823
|
+
this.set("codebaseScanReport", report);
|
|
3741
3824
|
}
|
|
3742
3825
|
setReadinessResult(result) {
|
|
3743
3826
|
this.$session.setKey("readinessResult", result);
|
|
@@ -4108,15 +4191,7 @@ async function invokeProgram(programId, callerInput, options) {
|
|
|
4108
4191
|
plainSettings = settings;
|
|
4109
4192
|
}
|
|
4110
4193
|
credentials = await login();
|
|
4111
|
-
|
|
4112
|
-
store.setAiSdkStampReported();
|
|
4113
|
-
stampAiSdkDetected({
|
|
4114
|
-
apiUser: credentials.apiUser,
|
|
4115
|
-
discoveredFeatures: store.session.discoveredFeatures,
|
|
4116
|
-
warehouseSources: getDetectedWarehouseSources(store.session),
|
|
4117
|
-
mayReportScanResults: mayReportScanResults(store.session)
|
|
4118
|
-
});
|
|
4119
|
-
}
|
|
4194
|
+
reportCodebaseScan(store);
|
|
4120
4195
|
if (needsAiApproval(store.session, credentials)) {
|
|
4121
4196
|
if (!options.workflow) return fail("AI processing approval is required before this program can run.");
|
|
4122
4197
|
if (!await park(options.workflow.confirmStep({
|
|
@@ -4189,6 +4264,7 @@ async function invokeProgram(programId, callerInput, options) {
|
|
|
4189
4264
|
agentFlow: planned.config.agentFlow,
|
|
4190
4265
|
excludedTaskTypes: planned.config.excludedTaskTypes,
|
|
4191
4266
|
seedTasks: planned.config.seedTasks ? () => planned.config.seedTasks(session()) : void 0,
|
|
4267
|
+
projectFacts: void 0,
|
|
4192
4268
|
hooks: sessionHooks(agentRun, session, (outcomes) => {
|
|
4193
4269
|
if (scoped) scoped.frameworkContext[TASK_OUTCOMES_KEY] = outcomes;
|
|
4194
4270
|
else store.setFrameworkContext(TASK_OUTCOMES_KEY, outcomes);
|
|
@@ -4604,7 +4680,7 @@ function buildSession(args) {
|
|
|
4604
4680
|
model: args.model,
|
|
4605
4681
|
scanConsent: args.ci ? "granted" : "undecided",
|
|
4606
4682
|
warehouseSourcesReported: false,
|
|
4607
|
-
|
|
4683
|
+
codebaseScanReport: null,
|
|
4608
4684
|
integration: args.integration ?? null,
|
|
4609
4685
|
frameworkContext: {},
|
|
4610
4686
|
typescript: false,
|
|
@@ -4754,11 +4830,22 @@ var PostHogDestination = class {
|
|
|
4754
4830
|
if (this.disabled) return;
|
|
4755
4831
|
const creds = this.getCredentials();
|
|
4756
4832
|
if (!creds) return;
|
|
4757
|
-
await this.
|
|
4833
|
+
if (await this.postSession(creds, toWirePayload(payload)) === "auth_rejected") this.disabled = true;
|
|
4758
4834
|
}
|
|
4759
|
-
|
|
4835
|
+
async sendScan(payload) {
|
|
4836
|
+
const creds = this.getCredentials();
|
|
4837
|
+
if (!creds) return;
|
|
4838
|
+
await this.postScan(creds, payload);
|
|
4839
|
+
}
|
|
4840
|
+
postSession(creds, body) {
|
|
4841
|
+
return this.postWithRetry(creds, "wizard/sessions", body);
|
|
4842
|
+
}
|
|
4843
|
+
postScan(creds, body) {
|
|
4844
|
+
return this.postWithRetry(creds, "wizard/scans", body);
|
|
4845
|
+
}
|
|
4846
|
+
buildRequest(creds, path, body) {
|
|
4760
4847
|
return {
|
|
4761
|
-
url: `${creds.host.apiHost.replace(/\/$/, "")}/api/projects/${creds.projectId}
|
|
4848
|
+
url: `${creds.host.apiHost.replace(/\/$/, "")}/api/projects/${creds.projectId}/${path}/`,
|
|
4762
4849
|
init: {
|
|
4763
4850
|
method: "POST",
|
|
4764
4851
|
headers: {
|
|
@@ -4769,8 +4856,9 @@ var PostHogDestination = class {
|
|
|
4769
4856
|
}
|
|
4770
4857
|
};
|
|
4771
4858
|
}
|
|
4772
|
-
|
|
4773
|
-
|
|
4859
|
+
/** POST with the retry policy above. Never throws. */
|
|
4860
|
+
async postWithRetry(creds, path, body) {
|
|
4861
|
+
const { url, init } = this.buildRequest(creds, path, body);
|
|
4774
4862
|
let attempt = 0;
|
|
4775
4863
|
let backoff = BASE_BACKOFF_MS;
|
|
4776
4864
|
let retriedAfter429 = false;
|
|
@@ -4782,26 +4870,25 @@ var PostHogDestination = class {
|
|
|
4782
4870
|
} catch (err) {
|
|
4783
4871
|
if (attempt >= MAX_ATTEMPTS) {
|
|
4784
4872
|
this.onError(err instanceof Error ? err : new Error(String(err)));
|
|
4785
|
-
return;
|
|
4873
|
+
return "gave_up";
|
|
4786
4874
|
}
|
|
4787
4875
|
await this.sleep(backoff);
|
|
4788
4876
|
backoff = Math.min(backoff * 2, MAX_BACKOFF_MS);
|
|
4789
4877
|
continue;
|
|
4790
4878
|
}
|
|
4791
4879
|
if (response.ok) {
|
|
4792
|
-
logToFile(`[task-stream]
|
|
4793
|
-
return;
|
|
4880
|
+
logToFile(`[task-stream] ${path} push ok: ${response.status}`);
|
|
4881
|
+
return "sent";
|
|
4794
4882
|
}
|
|
4795
4883
|
const status = response.status;
|
|
4796
4884
|
if (status === 401 || status === 403) {
|
|
4797
|
-
this.
|
|
4798
|
-
|
|
4799
|
-
return;
|
|
4885
|
+
this.onError(/* @__PURE__ */ new Error(`${path} auth failed: ${status}`));
|
|
4886
|
+
return "auth_rejected";
|
|
4800
4887
|
}
|
|
4801
4888
|
if (status === 429) {
|
|
4802
4889
|
if (retriedAfter429) {
|
|
4803
|
-
this.onError(/* @__PURE__ */ new Error(
|
|
4804
|
-
return;
|
|
4890
|
+
this.onError(/* @__PURE__ */ new Error(`${path} rate limited`));
|
|
4891
|
+
return "gave_up";
|
|
4805
4892
|
}
|
|
4806
4893
|
retriedAfter429 = true;
|
|
4807
4894
|
const wait = parseRetryAfter(response.headers.get("Retry-After"));
|
|
@@ -4811,8 +4898,8 @@ var PostHogDestination = class {
|
|
|
4811
4898
|
}
|
|
4812
4899
|
if (status >= 500) {
|
|
4813
4900
|
if (attempt >= MAX_ATTEMPTS) {
|
|
4814
|
-
this.onError(/* @__PURE__ */ new Error(
|
|
4815
|
-
return;
|
|
4901
|
+
this.onError(/* @__PURE__ */ new Error(`${path} server error: ${status}`));
|
|
4902
|
+
return "gave_up";
|
|
4816
4903
|
}
|
|
4817
4904
|
await this.sleep(backoff);
|
|
4818
4905
|
backoff = Math.min(backoff * 2, MAX_BACKOFF_MS);
|
|
@@ -4823,12 +4910,13 @@ var PostHogDestination = class {
|
|
|
4823
4910
|
try {
|
|
4824
4911
|
detail = await response.text();
|
|
4825
4912
|
} catch {}
|
|
4826
|
-
this.onError(/* @__PURE__ */ new Error(
|
|
4827
|
-
return;
|
|
4913
|
+
this.onError(/* @__PURE__ */ new Error(`${path} bad request (400): ${detail}`));
|
|
4914
|
+
return "gave_up";
|
|
4828
4915
|
}
|
|
4829
|
-
this.onError(/* @__PURE__ */ new Error(
|
|
4830
|
-
return;
|
|
4916
|
+
this.onError(/* @__PURE__ */ new Error(`${path} unexpected status: ${status}`));
|
|
4917
|
+
return "gave_up";
|
|
4831
4918
|
}
|
|
4919
|
+
return "gave_up";
|
|
4832
4920
|
}
|
|
4833
4921
|
};
|
|
4834
4922
|
//#endregion
|
|
@@ -4952,7 +5040,7 @@ var WizardRunSync = class {
|
|
|
4952
5040
|
type: "local_folder",
|
|
4953
5041
|
project_name: projectName
|
|
4954
5042
|
},
|
|
4955
|
-
...valid("2.
|
|
5043
|
+
...valid("2.84.0") ? { wizard_version: VERSION } : {},
|
|
4956
5044
|
idempotency_key: randomUUID()
|
|
4957
5045
|
});
|
|
4958
5046
|
const result = await this.request("POST", "", body, this.tasksAbort.signal);
|
|
@@ -5277,6 +5365,8 @@ var TaskStreamPush = class {
|
|
|
5277
5365
|
unsubscribe = null;
|
|
5278
5366
|
debounceTimer = null;
|
|
5279
5367
|
inFlight = null;
|
|
5368
|
+
/** The scan send, once the user agreed to share. Shutdown waits for it. */
|
|
5369
|
+
scanInFlight = null;
|
|
5280
5370
|
needsAnotherPush = false;
|
|
5281
5371
|
shuttingDown = false;
|
|
5282
5372
|
constructor(opts) {
|
|
@@ -5305,6 +5395,7 @@ var TaskStreamPush = class {
|
|
|
5305
5395
|
if (this.unsubscribe) return;
|
|
5306
5396
|
const target = store ?? this.store;
|
|
5307
5397
|
this.unsubscribe = target.subscribe(() => this.onStoreChange());
|
|
5398
|
+
this.sendScanIfShared();
|
|
5308
5399
|
}
|
|
5309
5400
|
/** Stop subscribing. Does not flush. */
|
|
5310
5401
|
detach() {
|
|
@@ -5335,8 +5426,8 @@ var TaskStreamPush = class {
|
|
|
5335
5426
|
this.detach();
|
|
5336
5427
|
if (!this.enabled) return;
|
|
5337
5428
|
const phase = this.store.session.runPhase;
|
|
5338
|
-
|
|
5339
|
-
const flush = this.flush();
|
|
5429
|
+
const isTerminal = phase === "completed" || phase === "error";
|
|
5430
|
+
const flush = Promise.all([isTerminal ? this.flush() : void 0, this.scanInFlight]);
|
|
5340
5431
|
if (timeoutMs <= 0) return;
|
|
5341
5432
|
let timer;
|
|
5342
5433
|
try {
|
|
@@ -5356,6 +5447,7 @@ var TaskStreamPush = class {
|
|
|
5356
5447
|
}
|
|
5357
5448
|
onStoreChange() {
|
|
5358
5449
|
if (!this.enabled || this.shuttingDown) return;
|
|
5450
|
+
this.sendScanIfShared();
|
|
5359
5451
|
const phase = this.store.session.runPhase;
|
|
5360
5452
|
if (phase === "idle") return;
|
|
5361
5453
|
this.selectRemoteSync();
|
|
@@ -5441,6 +5533,20 @@ var TaskStreamPush = class {
|
|
|
5441
5533
|
this.lastPushedQuestionId = payload.pending_input?.id ?? null;
|
|
5442
5534
|
await Promise.all(this.destinations.filter((d) => d.name !== "posthog" || this.remoteSync === "wizard-session").map((d) => d.send(event, payload).catch(() => {})));
|
|
5443
5535
|
}
|
|
5536
|
+
/**
|
|
5537
|
+
* Attach the shared scan to this session, once. It carries the stream's
|
|
5538
|
+
* `session_id`, so PostHog can join the scan to the session row.
|
|
5539
|
+
*/
|
|
5540
|
+
sendScanIfShared() {
|
|
5541
|
+
if (this.scanInFlight) return;
|
|
5542
|
+
const report = this.store.session.codebaseScanReport;
|
|
5543
|
+
if (!report) return;
|
|
5544
|
+
const payload = {
|
|
5545
|
+
...report,
|
|
5546
|
+
session_id: this.sessionId
|
|
5547
|
+
};
|
|
5548
|
+
this.scanInFlight = Promise.all(this.destinations.map((d) => d.sendScan?.(payload).catch(() => {}))).then(() => void 0);
|
|
5549
|
+
}
|
|
5444
5550
|
selectRemoteSync() {
|
|
5445
5551
|
if (this.remoteSync || !this.store.session.credentials) return;
|
|
5446
5552
|
if (this.store.session.runPhase === "idle") return;
|
|
@@ -5477,6 +5583,6 @@ function apiKeyCredentials(apiKey, options = {}) {
|
|
|
5477
5583
|
}) };
|
|
5478
5584
|
}
|
|
5479
5585
|
//#endregion
|
|
5480
|
-
export {
|
|
5586
|
+
export { SELF_DRIVING_INTEGRATE_PATH_KEY as $, getProgramConfig as A, config$3 as B, oauthErrorFromTokenBody as C, regionOption as Ct, findProgramConfig as D, Program as E, FEATURE_FLAGS_UNSUPPORTED as F, config$4 as G, DISPLAY_NAME as H, config$1 as I, PRICING_SHORT as J, NO_DEFAULT_LIMIT as K, config$2 as L, getSubcommandPrograms as M, config as N, getCommandPath as O, FEATURE_FLAGS_STEP_SKILL_ID as P, POSTHOG_PRESENT_KEY as Q, ERROR_TRACKING_PROJECT_PATH_KEY as R, oauthErrorFromCallbackParams as S, isHeadless as St, PROGRAM_REGISTRY as T, MANUAL_SDK_VARIANTS as U, detectSourceMapsProjects as V, SOURCE_MAPS_CONTEXT_KEYS as W, GITHUB_REQUIRED_BODY as X, detectSelfDrivingIntegrationProjects as Y, GITHUB_REQUIRED_MESSAGE as Z, missingOAuthScopes as _, detectTargets as _t, PostHogDestination as a, withScopeAdditions as at, buildCallbackErrorHtml as b, installSteeringSnippet as bt, buildSession as c, SIGNUP_WIZARD_READINESS_CONFIG as ct, SessionStore as d, config$10 as dt, config$5 as et, applyAgentProgress as f, config$11 as ft, getOAuthClientId as g, CLI_STEERING_TARGETS as gt, OAuthTokenResponseSchema as h, createSkillProgram as ht, createWizardRunSync as i, CONNECT_SLACK_SCOPE_ADDITIONS as it, getProvisioningScopesForProgram as j, getOAuthScopesForProgram as k, TASK_OUTCOMES_KEY as l, evaluateWizardReadiness as lt, logIn as m, config$13 as mt, resolveApiKeyLogin as n, config$7 as nt, createFileDestination as o, getAuditChecks as ot, TaskStatus as p, config$12 as pt, PRICING_LONG as q, TaskStreamPush as r, config$8 as rt, storeInteraction as s, SERVICE_LABELS as st, apiKeyCredentials as t, config$6 as tt, runProgram as u, getBlockingServiceKeys as ut, parseOAuthScopes as v, findTarget as vt, reportCodebaseScan as w, buildOAuthFailureMessage as x, headlessOption as xt, OAuthError as y, installOrUpdatePostHogCli as yt, detectErrorTrackingProjects as z };
|
|
5481
5587
|
|
|
5482
|
-
//# sourceMappingURL=programs-
|
|
5588
|
+
//# sourceMappingURL=programs-mxhRXwP-.js.map
|