@posthog/wizard 2.52.1 → 2.54.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 (114) hide show
  1. package/dist/{add-mcp-server-to-clients-C7P4_dhF.js → add-mcp-server-to-clients-B3TcwTT5.js} +5 -5
  2. package/dist/{add-mcp-server-to-clients-C7P4_dhF.js.map → add-mcp-server-to-clients-B3TcwTT5.js.map} +1 -1
  3. package/dist/{agent-interface-oqI_K3-4.js → agent-interface-CLvG6Rk9.js} +338 -28
  4. package/dist/agent-interface-CLvG6Rk9.js.map +1 -0
  5. package/dist/{agent-prompt-loader-DwFFfuZ4.js → agent-prompt-loader-Baqm1JMD.js} +5 -5
  6. package/dist/{agent-prompt-loader-DwFFfuZ4.js.map → agent-prompt-loader-Baqm1JMD.js.map} +1 -1
  7. package/dist/{agent-runner-CunYPDzL.js → agent-runner-D6zGTJqn.js} +179 -145
  8. package/dist/agent-runner-D6zGTJqn.js.map +1 -0
  9. package/dist/analytics-BBJE4hIu.js +2 -0
  10. package/dist/{analytics-DsXLkDwE.js → analytics-D7hsukY7.js} +5 -2
  11. package/dist/analytics-D7hsukY7.js.map +1 -0
  12. package/dist/{api-Dpnv0jVL.js → api-BSq9hLu5.js} +3 -3
  13. package/dist/{api-Dpnv0jVL.js.map → api-BSq9hLu5.js.map} +1 -1
  14. package/dist/bin.js +329 -190
  15. package/dist/bin.js.map +1 -1
  16. package/dist/{bounded-fs-bvlHO1PM.js → bounded-fs-Cq960M-V.js} +3 -3
  17. package/dist/{bounded-fs-bvlHO1PM.js.map → bounded-fs-Cq960M-V.js.map} +1 -1
  18. package/dist/{ci-install-BLSCzEZs.js → ci-install-w-mywB9x.js} +5 -5
  19. package/dist/{ci-install-BLSCzEZs.js.map → ci-install-w-mywB9x.js.map} +1 -1
  20. package/dist/{debug-D-lnRFLU.js → debug-CX6ZqL9r.js} +1 -1
  21. package/dist/{debug-BH67OSPW.js → debug-CbgLkSCY.js} +19 -10
  22. package/dist/debug-CbgLkSCY.js.map +1 -0
  23. package/dist/{defaults-DAE9_QMn.js → defaults-BWLIffh5.js} +1 -1
  24. package/dist/{defaults-DAE9_QMn.js.map → defaults-BWLIffh5.js.map} +1 -1
  25. package/dist/{env-api-key-DDVkPQmo.js → env-api-key-cjD4yfGT.js} +1 -1
  26. package/dist/{env-api-key-DDVkPQmo.js.map → env-api-key-cjD4yfGT.js.map} +1 -1
  27. package/dist/{environment-CPPBK-08.js → environment-BWuaOExh.js} +4 -4
  28. package/dist/{environment-CPPBK-08.js.map → environment-BWuaOExh.js.map} +1 -1
  29. package/dist/{file-watcher-Dgbe0xK9.js → file-watcher-D9tgVBkp.js} +2 -2
  30. package/dist/{file-watcher-Dgbe0xK9.js.map → file-watcher-D9tgVBkp.js.map} +1 -1
  31. package/dist/{headless-ui-BJbByiLj.js → headless-ui-rH97E35y.js} +2 -2
  32. package/dist/{headless-ui-BJbByiLj.js.map → headless-ui-rH97E35y.js.map} +1 -1
  33. package/dist/{interactive-ClJi6jV4.js → interactive-D-MVMdBl.js} +3 -3
  34. package/dist/{interactive-ClJi6jV4.js.map → interactive-D-MVMdBl.js.map} +1 -1
  35. package/dist/{mcp-C5pjmTsm.js → mcp-jKHwa45f.js} +2 -2
  36. package/dist/{mcp-C5pjmTsm.js.map → mcp-jKHwa45f.js.map} +1 -1
  37. package/dist/{mcp-prompt-streaming-BFDtuwJN.js → mcp-prompt-streaming-DxDftNHb.js} +5 -4
  38. package/dist/{mcp-prompt-streaming-BFDtuwJN.js.map → mcp-prompt-streaming-DxDftNHb.js.map} +1 -1
  39. package/dist/{non-interactive-C3DW7sGO.js → non-interactive-eXT2_WCR.js} +2 -2
  40. package/dist/{non-interactive-C3DW7sGO.js.map → non-interactive-eXT2_WCR.js.map} +1 -1
  41. package/dist/{orchestrator-tools-S88ycFO0.js → orchestrator-tools-CsXrPhsd.js} +3 -3
  42. package/dist/{orchestrator-tools-S88ycFO0.js.map → orchestrator-tools-CsXrPhsd.js.map} +1 -1
  43. package/dist/{package-manager-De6lmm9s.js → package-manager-CASp14jY.js} +2 -2
  44. package/dist/{package-manager-De6lmm9s.js.map → package-manager-CASp14jY.js.map} +1 -1
  45. package/dist/pi-CfdqOKDI.js +611 -0
  46. package/dist/pi-CfdqOKDI.js.map +1 -0
  47. package/dist/{playground-B4yTvjn4.js → playground-DuBvnGkP.js} +354 -19
  48. package/dist/playground-DuBvnGkP.js.map +1 -0
  49. package/dist/{posthog-mgz-FQlS.js → posthog-DDLIrku0.js} +1 -1
  50. package/dist/{posthog-mgz-FQlS.js.map → posthog-DDLIrku0.js.map} +1 -1
  51. package/dist/{posthog-integration-BA2aFHGz.js → posthog-integration-Dy5cNPaa.js} +16 -16
  52. package/dist/{posthog-integration-BA2aFHGz.js.map → posthog-integration-Dy5cNPaa.js.map} +1 -1
  53. package/dist/{provisioning-CtC0Ekeq.js → provisioning-CS6fQriR.js} +3 -3
  54. package/dist/{provisioning-CtC0Ekeq.js.map → provisioning-CS6fQriR.js.map} +1 -1
  55. package/dist/{queue-tools-DXg_5old.js → queue-tools-ai7gCWyU.js} +45 -32
  56. package/dist/queue-tools-ai7gCWyU.js.map +1 -0
  57. package/dist/{registry-B6ubVKTJ.js → registry-D0hx_-KP.js} +5 -5
  58. package/dist/{registry-B6ubVKTJ.js.map → registry-D0hx_-KP.js.map} +1 -1
  59. package/dist/{security-np5qnEMM.js → security-BNqgFjYh.js} +5 -5
  60. package/dist/security-BNqgFjYh.js.map +1 -0
  61. package/dist/{setup-utils-QwrY_J01.js → setup-utils-6qyTDNyd.js} +8 -8
  62. package/dist/{setup-utils-QwrY_J01.js.map → setup-utils-6qyTDNyd.js.map} +1 -1
  63. package/dist/{start-tui-DHEtMtnm.js → start-tui-DNkm-n-4.js} +36 -22
  64. package/dist/start-tui-DNkm-n-4.js.map +1 -0
  65. package/dist/{steps-ehGnaz9V.js → steps-CqHAVc8R.js} +7 -7
  66. package/dist/{steps-ehGnaz9V.js.map → steps-CqHAVc8R.js.map} +1 -1
  67. package/dist/{store-Cp_jvnNp.js → store-sIaF89XA.js} +6 -6
  68. package/dist/{store-Cp_jvnNp.js.map → store-sIaF89XA.js.map} +1 -1
  69. package/dist/{subagent-B9GiHZVj.js → subagent-CKNbRtfQ.js} +2 -2
  70. package/dist/{subagent-B9GiHZVj.js.map → subagent-CKNbRtfQ.js.map} +1 -1
  71. package/dist/{task-CmWToh2Q.js → task-DwzRxORh.js} +33 -23
  72. package/dist/task-DwzRxORh.js.map +1 -0
  73. package/dist/{task-stream-4I08S7A6.js → task-stream-BdJV-usk.js} +27 -6
  74. package/dist/task-stream-BdJV-usk.js.map +1 -0
  75. package/dist/{tasks-C6CfAC-D.js → tasks-yqJVuTvc.js} +2 -2
  76. package/dist/{tasks-C6CfAC-D.js.map → tasks-yqJVuTvc.js.map} +1 -1
  77. package/dist/{telemetry-3fcP3zSF.js → telemetry-UBL5MQtw.js} +3 -3
  78. package/dist/{telemetry-3fcP3zSF.js.map → telemetry-UBL5MQtw.js.map} +1 -1
  79. package/dist/{terminal-D4A6Hmkf.js → terminal-vo5Zl7j1.js} +807 -63
  80. package/dist/terminal-vo5Zl7j1.js.map +1 -0
  81. package/dist/{tools-pH2CNwNX.js → tools-Br8lP29r.js} +8 -10
  82. package/dist/tools-Br8lP29r.js.map +1 -0
  83. package/dist/warlock-smoke-test.ts +177 -1
  84. package/dist/{wizard-abort-BEBAXmPp.js → wizard-abort-BRsd7-aB.js} +1 -1
  85. package/dist/{wizard-abort-BbsBpCCV.js → wizard-abort-FIC6lKCs.js} +4 -4
  86. package/dist/{wizard-abort-BbsBpCCV.js.map → wizard-abort-FIC6lKCs.js.map} +1 -1
  87. package/dist/{wizard-session-BAZql11N.js → wizard-session-CwgR5y3-.js} +2 -1
  88. package/dist/wizard-session-CwgR5y3-.js.map +1 -0
  89. package/dist/{wizard-session-C5lZPPEc.js → wizard-session-DsK16SGs.js} +1 -1
  90. package/dist/yara-hooks--QA2Cwjv.js +2 -0
  91. package/dist/{yara-hooks-BGBQ4IcA.js → yara-hooks-DxpCD72V.js} +39 -83
  92. package/dist/yara-hooks-DxpCD72V.js.map +1 -0
  93. package/package.json +2 -1
  94. package/dist/agent-interface-oqI_K3-4.js.map +0 -1
  95. package/dist/agent-runner-CunYPDzL.js.map +0 -1
  96. package/dist/analytics-DsXLkDwE.js.map +0 -1
  97. package/dist/analytics-agQIoFg6.js +0 -2
  98. package/dist/commandments-BagyrYRW.js +0 -2
  99. package/dist/commandments-DiMtIz1o.js +0 -42
  100. package/dist/commandments-DiMtIz1o.js.map +0 -1
  101. package/dist/debug-BH67OSPW.js.map +0 -1
  102. package/dist/pi-BOCjsfgo.js +0 -575
  103. package/dist/pi-BOCjsfgo.js.map +0 -1
  104. package/dist/playground-B4yTvjn4.js.map +0 -1
  105. package/dist/queue-tools-DXg_5old.js.map +0 -1
  106. package/dist/security-np5qnEMM.js.map +0 -1
  107. package/dist/start-tui-DHEtMtnm.js.map +0 -1
  108. package/dist/task-CmWToh2Q.js.map +0 -1
  109. package/dist/task-stream-4I08S7A6.js.map +0 -1
  110. package/dist/terminal-D4A6Hmkf.js.map +0 -1
  111. package/dist/tools-pH2CNwNX.js.map +0 -1
  112. package/dist/wizard-session-BAZql11N.js.map +0 -1
  113. package/dist/yara-hooks-BGBQ4IcA.js.map +0 -1
  114. package/dist/yara-hooks-BfhKhlIT.js +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-CfdqOKDI.js","names":[],"sources":["../src/lib/agent/aio-capture.ts","../src/lib/agent/runner/harness/pi/completion.ts","../src/lib/agent/runner/harness/pi/index.ts"],"sourcesContent":["/**\n * aio-capture — mirror wizard LLM calls into the authenticated project's\n * AI Observability tab as `$ai_generation` events. Gated on `--capture-aio`\n * (dev/test builds only); returns a no-op instance when disabled so the\n * wire-in points stay a no-op with zero overhead.\n *\n * The wizard's LLM calls happen inside subprocesses we don't own (the\n * claude-agent-sdk CLI on the anthropic path, pi's own runtime on pi), so we\n * can't wrap the client with `posthog-node`'s `wrapAnthropic`. Instead, each\n * harness surfaces assistant turns on the way back — the SDK message stream\n * on anthropic, `agentSession.subscribe(message_end)` on pi — and this module\n * composes an `$ai_generation` event from either shape.\n *\n * For the Conversation tab in AIO to render anything, each generation needs\n * `$ai_input` (the messages the model saw when it produced this turn). The\n * initial prompt is passed to the SDK subprocess and never echoed back on\n * the stream, so callers must hand it to `setInitialPrompt` before the run\n * starts. From there we track user/assistant turns as they flow through the\n * stream, snapshotting the running conversation into each generation's\n * `$ai_input` and firing `$ai_input_state` / `$ai_output_state` on the\n * terminal `$ai_trace` event.\n *\n * POSTs are fire-and-forget: failures are debug-logged and never surfaced to\n * the main agent flow. Losing an AIO event must never break a run.\n */\n\nimport { logToFile } from '@utils/debug';\nimport { VERSION } from '@lib/version';\n\n/** Conversation turn shape both harnesses normalize to. Matches Anthropic\n * message role/content conventions, which is also what AIO's Conversation\n * tab knows how to render. */\ntype Turn = { role: 'user' | 'assistant'; content: unknown };\n\n/** Common shape both harness transforms emit; fed to the shared POST. */\ntype LLMTurn = {\n provider: 'anthropic' | 'openai';\n model: string;\n /** Conversation up to (but not including) this assistant turn — the\n * messages the model saw. Sent as `$ai_input`. */\n input: Turn[];\n /** Content blocks (text + tool_use), passed through as $ai_output_choices. */\n outputChoices: unknown[];\n inputTokens?: number;\n outputTokens?: number;\n cacheReadTokens?: number;\n cacheCreationTokens?: number;\n /** Wall-clock ms since the previous assistant turn on this stream. */\n latencyMs: number;\n generationId?: string;\n isError: boolean;\n};\n\nexport type AioCapture = {\n /** Set the initial prompt the harness is about to send to the LLM. The\n * wizard passes this into the SDK subprocess out-of-band, so it never\n * appears on the return message stream — the caller must hand it to us\n * explicitly if we want `$ai_input` to include it. Safe to call multiple\n * times: latest wins, prior conversation state resets. */\n setInitialPrompt(prompt: string): void;\n /** Called for every SDK message on the anthropic harness stream. */\n captureFromAnthropicSDKMessage(msg: unknown): void;\n /** Called for every subscribe event on the pi harness. */\n captureFromPiMessageEndEvent(event: unknown): void;\n};\n\nconst noop = (_: unknown): void => undefined;\nconst NOOP: AioCapture = {\n setInitialPrompt: noop,\n captureFromAnthropicSDKMessage: noop,\n captureFromPiMessageEndEvent: noop,\n};\n\nexport function createAioCapture(args: {\n enabled: boolean;\n projectApiKey: string;\n apiHost: string;\n /** Trace tags from `buildRunTags` (program_id, integration, run_id, build, skill_id). */\n runTags: Record<string, string>;\n}): AioCapture {\n if (!args.enabled || !args.projectApiKey || !args.apiHost) return NOOP;\n\n const { projectApiKey, apiHost, runTags } = args;\n const distinctId = `wizard-cli-${VERSION}`;\n const captureUrl = `${apiHost.replace(/\\/$/, '')}/capture/`;\n const runStartAt = Date.now();\n // Latency is measured against the previous assistant turn on this stream —\n // a rough proxy for time-to-first-token that doesn't require SDK-internal\n // timings. Reset per createAioCapture (once per agent run).\n let prevTurnAt = runStartAt;\n // Fire the top-level `$ai_trace` event at most once per instance. Both\n // harnesses can emit terminal signals, and pi in particular may emit\n // multiple `agent_end` events across nudges — first-wins keeps trace\n // metadata stable in AIO.\n let traceEnded = false;\n\n // Running conversation state — grows as user and assistant turns flow\n // through the stream. Snapshotted into `$ai_input` on each generation.\n let initialPrompt: string | undefined;\n let conversation: Turn[] = [];\n let lastAssistantContent: unknown[] | undefined;\n\n const postEvent = (\n event: string,\n properties: Record<string, unknown>,\n ): void => {\n const body = {\n api_key: projectApiKey,\n event,\n distinct_id: distinctId,\n properties: {\n $ai_trace_id: runTags.run_id ?? '',\n ...runTags,\n ...properties,\n },\n timestamp: new Date().toISOString(),\n };\n\n // Fire-and-forget. `.then` + `.catch` (not `await`) so the caller returns\n // immediately; both branches only log. Errors must never propagate into\n // the agent stream loop.\n fetch(captureUrl, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n })\n .then((res) => {\n if (!res.ok) {\n logToFile(`[aio-capture] POST failed status=${res.status}`);\n }\n })\n .catch((err) => {\n logToFile(\n `[aio-capture] POST error: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n });\n };\n\n const postGeneration = (turn: LLMTurn): void => {\n postEvent('$ai_generation', {\n $ai_provider: turn.provider,\n $ai_model: turn.model,\n $ai_input: turn.input,\n $ai_output_choices: turn.outputChoices,\n $ai_input_tokens: turn.inputTokens ?? 0,\n $ai_output_tokens: turn.outputTokens ?? 0,\n $ai_cache_read_input_tokens: turn.cacheReadTokens ?? 0,\n $ai_cache_creation_input_tokens: turn.cacheCreationTokens ?? 0,\n $ai_latency: turn.latencyMs / 1000,\n $ai_generation_id: turn.generationId ?? '',\n $ai_is_error: turn.isError,\n });\n };\n\n // Emit the top-level `$ai_trace` event. Without this, PostHog builds a\n // pseudo-trace from the generations — the timeline and aggregates still\n // work, but the trace has no readable name and the Conversation tab shows\n // \"No top-level trace event\". Sending this once per run fills that in,\n // and `$ai_input_state` / `$ai_output_state` populate the trace-level\n // Conversation view.\n const sendTraceEnd = (opts: { isError: boolean }): void => {\n if (traceEnded) return;\n traceEnded = true;\n postEvent('$ai_trace', {\n $ai_span_name: runTags.program_id ?? 'wizard-run',\n $ai_latency: (Date.now() - runStartAt) / 1000,\n $ai_is_error: opts.isError,\n $ai_input_state: initialPrompt\n ? [{ role: 'user', content: [{ type: 'text', text: initialPrompt }] }]\n : [],\n $ai_output_state: lastAssistantContent ?? [],\n });\n };\n\n const anthropicAssistantTurn = (msg: unknown): LLMTurn | null => {\n const m = msg as {\n type?: string;\n message?: {\n id?: string;\n model?: string;\n content?: unknown;\n usage?: {\n input_tokens?: number;\n output_tokens?: number;\n cache_read_input_tokens?: number;\n cache_creation_input_tokens?: number;\n };\n };\n };\n if (m?.type !== 'assistant' || !m.message) return null;\n const now = Date.now();\n const latencyMs = now - prevTurnAt;\n prevTurnAt = now;\n return {\n provider: 'anthropic',\n model: m.message.model ?? 'unknown',\n input: [...conversation],\n outputChoices: Array.isArray(m.message.content) ? m.message.content : [],\n inputTokens: m.message.usage?.input_tokens,\n outputTokens: m.message.usage?.output_tokens,\n cacheReadTokens: m.message.usage?.cache_read_input_tokens,\n cacheCreationTokens: m.message.usage?.cache_creation_input_tokens,\n latencyMs,\n generationId: m.message.id,\n isError: false,\n };\n };\n\n const piAssistantTurn = (event: unknown): LLMTurn | null => {\n const e = event as {\n type?: string;\n message?: {\n id?: string;\n role?: string;\n model?: string;\n content?: unknown;\n usage?: {\n input_tokens?: number;\n output_tokens?: number;\n cache_read_input_tokens?: number;\n cache_creation_input_tokens?: number;\n };\n };\n };\n // Pi emits message_end for user prompts too — filter to assistant only,\n // mirroring the existing role guard at harness/pi/index.ts:434.\n if (e?.type !== 'message_end' || e.message?.role !== 'assistant') {\n return null;\n }\n const now = Date.now();\n const latencyMs = now - prevTurnAt;\n prevTurnAt = now;\n return {\n provider: 'anthropic',\n model: e.message.model ?? 'unknown',\n input: [...conversation],\n outputChoices: Array.isArray(e.message.content) ? e.message.content : [],\n inputTokens: e.message.usage?.input_tokens,\n outputTokens: e.message.usage?.output_tokens,\n cacheReadTokens: e.message.usage?.cache_read_input_tokens,\n cacheCreationTokens: e.message.usage?.cache_creation_input_tokens,\n latencyMs,\n generationId: e.message.id,\n isError: false,\n };\n };\n\n return {\n setInitialPrompt(prompt) {\n initialPrompt = prompt;\n // Reset conversation to the initial user turn — this is the only way\n // the initial prompt gets into `$ai_input` for the first generation,\n // since the SDK subprocess consumes it internally and doesn't echo it\n // on the return stream.\n conversation = [\n { role: 'user', content: [{ type: 'text', text: prompt }] },\n ];\n lastAssistantContent = undefined;\n },\n captureFromAnthropicSDKMessage(msg) {\n try {\n // User turns (tool_result blocks between assistant turns) accumulate\n // in the conversation so the next assistant generation carries the\n // full context the model actually saw.\n const m = msg as {\n type?: string;\n message?: { role?: string; content?: unknown };\n is_error?: boolean;\n };\n if (m?.type === 'user' && m.message) {\n conversation.push({\n role: 'user',\n content: m.message.content ?? [],\n });\n }\n const turn = anthropicAssistantTurn(msg);\n if (turn) {\n postGeneration(turn);\n // Push the assistant turn AFTER posting so the current generation's\n // $ai_input is the conversation as the model saw it (not including\n // its own response), and later turns include this one.\n conversation.push({\n role: 'assistant',\n content: turn.outputChoices,\n });\n lastAssistantContent = turn.outputChoices;\n }\n // Terminal: SDK emits a `result` message at end of run.\n if (m?.type === 'result') {\n sendTraceEnd({ isError: !!m.is_error });\n }\n } catch (err) {\n logToFile(\n `[aio-capture] anthropic compose failed: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n }\n },\n captureFromPiMessageEndEvent(event) {\n try {\n // Pi's subscribe callback surfaces both user and assistant\n // message_end events. Accumulate user turns the same way as the\n // anthropic path so `$ai_input` matches the model's view.\n const e = event as {\n type?: string;\n message?: { role?: string; content?: unknown };\n willRetry?: boolean;\n };\n if (\n e?.type === 'message_end' &&\n e.message?.role === 'user' &&\n e.message\n ) {\n conversation.push({\n role: 'user',\n content: e.message.content ?? [],\n });\n }\n const turn = piAssistantTurn(event);\n if (turn) {\n postGeneration(turn);\n conversation.push({\n role: 'assistant',\n content: turn.outputChoices,\n });\n lastAssistantContent = turn.outputChoices;\n }\n // Terminal: pi emits `agent_end` when the session's prompt() resolves.\n if (e?.type === 'agent_end' && !e.willRetry) {\n sendTraceEnd({ isError: false });\n }\n } catch (err) {\n logToFile(\n `[aio-capture] pi compose failed: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n }\n },\n };\n}\n","import { AgentErrorType } from '@lib/agent/signals';\n\n/** Which completion guard should fail a pi run, or undefined for a clean finish. */\nexport function completionFailure(args: {\n toolCalls: number;\n openTasks: boolean;\n}): AgentErrorType | undefined {\n // No tool call at all — the project was never touched.\n if (args.toolCalls === 0) return AgentErrorType.NO_PROGRESS;\n // Acted but left tasks in its own plan unfinished (skill install not required).\n if (args.openTasks) return AgentErrorType.INCOMPLETE_TASKS;\n return undefined;\n}\n","/**\n * The `pi` backend — the challenger. Drives pi.dev's coding agent\n * (`@earendil-works/pi-coding-agent`) against the PostHog LLM gateway, behind\n * `wizard-orchestrator`. It owns the agent loop and model transport; prompt\n * assembly, error routing, and the outro stay in `linear.ts`, shared with the\n * `anthropic` control.\n *\n * Transport: the gateway is registered as an `anthropic-messages` provider\n * (same protocol the claude-agent-sdk path uses), bearer auth, Bedrock-fallback\n * + wizard metadata/flag headers, model id matched to `anthropic` for a clean\n * A/B. Security parity (canUseTool + YARA) and skills/MCP discovery are\n * follow-ups (#525, #524 skills) — v1 uses pi's built-in coding tools.\n */\n\nimport fs from 'fs';\nimport path from 'path';\nimport { getUI } from '@ui';\nimport { getLogFilePath, logToFile } from '@utils/debug';\nimport {\n Harness,\n Sequence,\n WIZARD_REMARK_EVENT_NAME,\n WIZARD_USER_AGENT,\n} from '@lib/constants';\nimport { analytics } from '@utils/analytics';\nimport { AgentErrorType } from '@lib/agent/agent-interface';\nimport { AgentSignals, REMARK_INSTRUCTION } from '@lib/agent/signals';\nimport { AgentOutputSignals } from '@lib/agent/output-signals';\nimport { assembleCommandments } from '../../switchboard/commandments';\nimport { buildGatewayProvider, GATEWAY_PROVIDER } from './gateway';\nimport { createAioCapture } from '@lib/agent/aio-capture';\nimport type {\n AgentResult,\n AgentHarness,\n BackendRunInputs,\n TaskRunInputs,\n} from '../types';\nimport type { BootstrapResult } from '@lib/agent/runner/shared/types';\nimport type { TaskStore } from './tasks';\nimport { completionFailure } from './completion';\n\n/** Injects the MCP server `instructions` pi-mcp-adapter drops (project env, skill steer, tool domains) into the system prompt, falling back to a bootstrap-derived project block when the warm-connect captured none. */\nfunction piMcpContext(boot: BootstrapResult, instructions?: string): string {\n if (instructions) {\n // Heading + verbatim server instructions (see PR #862 for a full sample).\n return ['', '## PostHog MCP server', instructions].join('\\n');\n }\n const project = boot.project?.name\n ? `${boot.project.name} (id ${boot.credentials.projectId})`\n : `id ${boot.credentials.projectId}`;\n // Fallback: a `## PostHog project` block with name/id, host, region.\n return [\n '',\n '## PostHog project',\n 'Your `posthog_exec` calls run against this project:',\n `- Project: ${project}`,\n `- Host: ${boot.credentials.host.apiHost}`,\n `- Region: ${boot.credentials.host.region}`,\n ].join('\\n');\n}\n\n/**\n * The ONLY environment variables pi's tool subprocesses (bash → npm/pip/…) are\n * allowed to see. Everything else — every secret (POSTHOG_PERSONAL_API_KEY,\n * ANTHROPIC_*, AWS_*), every ambient credential, the parent process's whole env\n * — is dropped before a child is spawned. pi's own gateway auth is programmatic\n * (the access token never lives in env), so a minimal env costs the agent\n * nothing while closing the leak that exposed the key before. Kept to what a\n * package manager genuinely needs to run.\n */\nconst ALLOWED_SUBPROCESS_ENV_KEYS = [\n 'PATH',\n 'HOME',\n 'SHELL',\n 'USER',\n 'LOGNAME',\n 'TMPDIR',\n 'TMP',\n 'TEMP',\n 'TERM',\n 'LANG',\n 'LC_ALL',\n 'LC_CTYPE',\n 'NODE_EXTRA_CA_CERTS',\n 'SSL_CERT_FILE',\n 'SSL_CERT_DIR',\n 'HTTP_PROXY',\n 'HTTPS_PROXY',\n 'NO_PROXY',\n 'http_proxy',\n 'https_proxy',\n 'no_proxy',\n];\n\n/** A fresh subprocess env holding only the allowlisted keys present in process.env. */\nexport function buildScrubbedEnv(): NodeJS.ProcessEnv {\n const env: NodeJS.ProcessEnv = {};\n for (const key of ALLOWED_SUBPROCESS_ENV_KEYS) {\n const value = process.env[key];\n if (value !== undefined) env[key] = value;\n }\n return env;\n}\n\n/**\n * Tag a tool with an execution mode (mutates + returns it). Read-only tools are\n * `parallel` so a single turn that batches independent reads/searches runs them\n * at once; mutating/install tools are `sequential` so a batch never races writes\n * or concurrent installs. pi-agent-core runs a batch in parallel only when no\n * tool in it is `sequential`.\n */\nexport function withMode<T>(tool: T, mode: 'sequential' | 'parallel'): T {\n (tool as { executionMode?: 'sequential' | 'parallel' }).executionMode = mode;\n return tool;\n}\n\n/** Pull plain text out of a pi AgentMessage (content is text/image blocks). */\nexport function extractText(message: unknown): string {\n const content = (message as { content?: unknown })?.content;\n if (typeof content === 'string') return content;\n if (Array.isArray(content)) {\n return content\n .filter((c): c is { type: string; text: string } => {\n const block = c as { type?: string; text?: unknown };\n return block?.type === 'text' && typeof block.text === 'string';\n })\n .map((c) => c.text)\n .join('');\n }\n return '';\n}\n\n/**\n * Surface `[DASHBOARD_URL]` / `[NOTEBOOK_URL]` markers the agent prints (after\n * the MCP creates them) into the outro link, mirroring the anthropic path's\n * signal parsing (#9). The marker carries the URL the MCP returned.\n */\nexport function applyOutroMarkers(textBlock: string): void {\n const markers: Array<[string, (url: string) => void]> = [\n [AgentSignals.DASHBOARD_URL, (url) => getUI().setDashboardUrl(url)],\n [AgentSignals.NOTEBOOK_URL, (url) => getUI().setNotebookUrl(url)],\n ];\n for (const [marker, apply] of markers) {\n const idx = textBlock.indexOf(marker);\n if (idx === -1) continue;\n const url = textBlock\n .slice(idx + marker.length)\n .trim()\n .split(/\\s/)[0];\n if (url) apply(url);\n }\n}\n\n/**\n * The text of the last `[STATUS] …` line in a block, if any. Last wins so the\n * spinner shows the most recent action when a turn prints several.\n */\nexport function lastStatusLine(textBlock: string): string | undefined {\n let status: string | undefined;\n for (const line of textBlock.split('\\n')) {\n const idx = line.indexOf(AgentSignals.STATUS);\n if (idx !== -1) {\n status = line.slice(idx + AgentSignals.STATUS.length).trim();\n }\n }\n return status || undefined;\n}\n\n/** Cap on completion-guard re-prompts while tasks remain open (see the run loop). */\nconst MAX_CONTINUE_NUDGES = 20;\n\n/** Nudge re-sent when the agent stops early with tasks still open. */\nconst CONTINUE_INSTRUCTION =\n 'You still have open tasks in your list (not all are marked `completed`). Do not stop — pick up the next `in_progress` or `pending` task and keep working until every task is `completed`. Continue now.';\n\n/** True while any task in the store is not yet `completed`. */\nfunction hasOpenTasks(store: TaskStore): boolean {\n for (const t of store.values()) if (t.status !== 'completed') return true;\n return false;\n}\n\nexport const piBackend: AgentHarness = {\n name: Harness.pi,\n\n async run(inputs: BackendRunInputs): Promise<AgentResult> {\n const { session, boot, prompt, spinner, config, programConfig } = inputs;\n const modelId = inputs.model;\n\n const capture = createAioCapture({\n enabled: session.captureAio,\n projectApiKey: boot.credentials.projectApiKey,\n apiHost: boot.credentials.host.apiHost,\n runTags: boot.wizardMetadata,\n });\n\n // Init banner (parity #5).\n getUI().log.step('Initializing Wizard agent...');\n getUI().log.step(`Verbose logs: ${getLogFilePath()}`);\n getUI().log.success(\"Agent initialized. Let's get cooking!\");\n\n spinner.start(config.spinnerMessage ?? 'Customizing your PostHog setup...');\n\n // Same `agent completed`/`agent aborted` shape as anthropic.\n const startTime = Date.now();\n const signals = new AgentOutputSignals();\n let assistantTurns = 0;\n // Tool calls across the whole run. Zero means the agent only ever produced\n // text and never acted — a no-op that leaves the project untouched.\n let toolCalls = 0;\n const runDurations = () => {\n const durationMs = Date.now() - startTime;\n return {\n duration_ms: durationMs,\n duration_seconds: Math.round(durationMs / 1000),\n };\n };\n const captureAborted = () =>\n analytics.wizardCapture('agent aborted', {\n ...runDurations(),\n model: modelId,\n });\n\n try {\n const {\n createAgentSession,\n DefaultResourceLoader,\n SessionManager,\n AuthStorage,\n ModelRegistry,\n getAgentDir,\n createLsToolDefinition,\n createFindToolDefinition,\n createGrepToolDefinition,\n createBashToolDefinition,\n createReadToolDefinition,\n createEditToolDefinition,\n createWriteToolDefinition,\n } = await import('@earendil-works/pi-coding-agent');\n\n // the claude-agent-sdk path. The provider spec is shared with the\n // orchestrator's per-task sessions (gateway.ts).\n const { provider, caps } = buildGatewayProvider({\n gatewayUrl: boot.credentials.host.gatewayUrl,\n accessToken: boot.credentials.accessToken,\n wizardMetadata: boot.wizardMetadata,\n wizardFlags: boot.wizardFlags,\n modelId,\n effort: inputs.thinkingLevel,\n });\n const registry = ModelRegistry.inMemory(AuthStorage.create());\n registry.registerProvider(GATEWAY_PROVIDER, provider as never);\n\n const model = registry.find(GATEWAY_PROVIDER, modelId);\n if (!model) {\n return {\n error: AgentErrorType.API_ERROR,\n message: 'pi: gateway model could not be resolved',\n };\n }\n\n // System prompt = wizard commandments. Skip project context files /\n // user extensions / skills so the run is hermetic; skills discovery is a\n // follow-up (#524).\n //\n // Fail-closed security (#525): an extension intercepts EVERY tool call —\n // built-in and custom — and reuses the anthropic policy (canUseTool\n // allowlist + .env fencing + YARA). `noExtensions: true` only suppresses\n // disk-discovered extensions; explicit `extensionFactories` still load,\n // so the fence is on while the target project can't inject its own.\n // Shared flag: true while a wizard_ask overlay is open. The ask tool\n // flips it; the security gate reads it to block Write/Edit meanwhile.\n const askState = { pending: false };\n\n const { createSecurityExtension } = await import('./security');\n const security = createSecurityExtension({\n disallowedTools: programConfig.disallowedTools,\n getWizardAskPending: () => askState.pending,\n triageProvider: boot.triageProvider,\n // Where pi's bash runs; the rm allowance is confined to this tree.\n workingDirectory: session.installDir,\n });\n\n // Pay warlock's WASM-init + rule-compile cost now, off the tool-call\n // path, so the first scanned call doesn't eat cold-start latency.\n const { prewarmYaraScanner } = await import('@lib/yara-hooks');\n void prewarmYaraScanner();\n\n // Wire the real PostHog MCP into pi (#10): load pi's MCP adapter and point\n // it at the hosted MCP the anthropic path uses, so dashboards/insights are\n // created through the sanctioned MCP. Best-effort — if it can't load or\n // connect, the run continues (minus the dashboard step) rather than failing\n // the whole integration. The security factory is always first.\n const extensionFactories = [security.factory] as Array<\n (pi: unknown) => void\n >;\n let mcpCleanup: (() => void) | undefined;\n let mcpInstructions: string | undefined;\n try {\n const { setupPostHogMcp, fetchInstructions } = await import('./mcp');\n // Overlaps the network handshake with the adapter's jiti load.\n const instructionsPromise = fetchInstructions(\n boot.credentials.host.mcpUrl,\n boot.credentials.accessToken,\n WIZARD_USER_AGENT,\n );\n const mcp = await setupPostHogMcp({\n mcpUrl: boot.credentials.host.mcpUrl,\n accessToken: boot.credentials.accessToken,\n userAgent: WIZARD_USER_AGENT,\n });\n extensionFactories.push(mcp.extensionFactory);\n mcpCleanup = mcp.cleanup;\n mcpInstructions = await instructionsPromise;\n } catch (err) {\n logToFile(`[pi] PostHog MCP setup skipped: ${String(err)}`);\n analytics.wizardCapture('mcp setup failed', {\n harness: 'pi',\n scope: 'run',\n error: String(err).slice(0, 300),\n });\n }\n\n const resourceLoader = new DefaultResourceLoader({\n cwd: session.installDir,\n agentDir: getAgentDir(),\n systemPrompt:\n assembleCommandments({\n program: programConfig.id,\n sequence: Sequence.linear,\n harness: Harness.pi,\n caps: { bash: true, posthogMcp: true },\n }) +\n '\\n' +\n piMcpContext(boot, mcpInstructions),\n noExtensions: true,\n noSkills: true,\n noContextFiles: true,\n noPromptTemplates: true,\n noThemes: true,\n extensionFactories,\n });\n await resourceLoader.reload();\n\n // Wizard capabilities as custom tools (pi has no MCP): skill\n // discovery/install + fenced .env edits, same names as the MCP server so\n // the shared prompt is unchanged. pi's built-in Read/Write/Edit/Bash do\n // the code changes. Loaded lazily — it pulls in typebox (ESM), which must\n // stay out of the static module graph so CommonJS unit tests can load the\n // backend seam without parsing it.\n const { createWizardPiTools } = await import('./tools');\n const { createWizardPiTaskTools } = await import('./tasks');\n const { createDispatchAgentTool } = await import('./subagent');\n // Created once so the run loop can read the store for the completion guard.\n const wizardTaskTools = createWizardPiTaskTools();\n // The one bash the agent (and its subagents) may use: every subprocess it\n // spawns gets a scrubbed env, so no secret or ambient variable reaches an\n // `npm install`. Shared with the subagent so the lockdown is inherited.\n const scrubbedBash = withMode(\n createBashToolDefinition(session.installDir, {\n spawnHook: (ctx) => ({ ...ctx, env: buildScrubbedEnv() }),\n }),\n 'sequential',\n );\n\n const customTools = [\n // Built-ins re-registered explicitly. `noTools: 'builtin'` disables pi's\n // defaults so we can supply the env-scrubbed bash above; read/edit/write\n // are the stock definitions. Reads run in parallel so a batched turn of\n // independent reads executes at once; edit/write/bash stay sequential.\n withMode(createReadToolDefinition(session.installDir), 'parallel'),\n withMode(createEditToolDefinition(session.installDir), 'sequential'),\n withMode(createWriteToolDefinition(session.installDir), 'sequential'),\n scrubbedBash,\n // Native ls/find/grep so the agent explores with proper tools instead\n // of fence-blocked `bash {ls/find}` (the profiled retry-spirals came\n // from this gap). Parallel — exploration batches cleanly.\n withMode(createLsToolDefinition(session.installDir), 'parallel'),\n withMode(createFindToolDefinition(session.installDir), 'parallel'),\n withMode(createGrepToolDefinition(session.installDir), 'parallel'),\n ...createWizardPiTools({\n workingDirectory: session.installDir,\n skillsBaseUrl: boot.skillsBaseUrl,\n triageProvider: boot.triageProvider,\n detectPackageManager: config.detectPackageManager,\n // The host ask bridge — lets interactive programs (self-driving) ask\n // the user through pi. Threaded from the runner, same path as the\n // anthropic harness. Absent in CI → the tool errors on call.\n askBridge: inputs.askBridge,\n maxQuestions: config.maxQuestions,\n onAskPendingChange: (pending) => {\n askState.pending = pending;\n },\n // Skip wizard_ask when the program disallows it (bare pi tool names\n // don't match the MCP-prefixed disallow list at the security gate).\n disallowedTools: programConfig.disallowedTools,\n }),\n // Task/todo tools (#526): render the todo list live in the TUI, parity\n // with the anthropic path.\n ...wizardTaskTools.tools,\n // Controlled subagent dispatch (#526): a nested fenced session with a\n // read-only toolset and no dispatch_agent of its own, so it can't\n // escape the fence or recurse.\n createDispatchAgentTool({\n model,\n modelRegistry: registry,\n cwd: session.installDir,\n agentDir: getAgentDir(),\n securityFactory: security.factory as (pi: unknown) => void,\n bashTool: scrubbedBash,\n sdk: { createAgentSession, DefaultResourceLoader, SessionManager },\n }),\n ];\n\n const { session: agentSession } = await createAgentSession({\n model,\n modelRegistry: registry,\n // Reasoning effort from the switchboard capability matrix (undefined =\n // pi's default). Sent as `reasoning_effort` for openai-completions.\n thinkingLevel: caps.thinkingLevel,\n cwd: session.installDir,\n sessionManager: SessionManager.inMemory(session.installDir),\n resourceLoader,\n // Disable the default built-in tools; `customTools` re-registers\n // read/edit/write + an env-scrubbed bash, so no subprocess inherits the\n // host env. Custom + extension tools stay enabled.\n noTools: 'builtin',\n customTools,\n });\n\n // Fire the extension lifecycle — what interactive mode does via\n // rebindCurrentSession. createAgentSession builds the session but does not\n // emit session_start on its own, and the MCP adapter connects on that\n // event; without this its tools report \"MCP not initialized\".\n await agentSession.bindExtensions({});\n\n // Map pi events onto the run spinner + the log file, mirroring the\n // anthropic path's log shape (assistant turns + tool I/O) and driving the\n // single run spinner with one stable status at a time (no overlap).\n const unsubscribe = agentSession.subscribe((event) => {\n // Mirror the turn into AIO. No-op when --capture-aio is off. Runs\n // before the role guard so the module's own filter (assistant-only)\n // stays the single source of truth for what's captured.\n capture.captureFromPiMessageEndEvent(event);\n\n switch (event.type) {\n case 'message_end': {\n // User prompts also emit message_end; only assistant turns count.\n if ((event.message as { role?: string })?.role !== 'assistant') {\n break;\n }\n assistantTurns += 1;\n const assistant = extractText(event.message).trim();\n if (assistant) {\n logToFile(`[pi] assistant: ${assistant.slice(0, 1000)}`);\n applyOutroMarkers(assistant);\n // Surface [STATUS] lines into the live spinner + status history,\n // mirroring the anthropic path — pi otherwise drops them.\n const statusText = lastStatusLine(assistant);\n if (statusText) {\n getUI().pushStatus(statusText);\n spinner.message(statusText);\n }\n for (const line of assistant.split('\\n')) signals.push(line);\n }\n break;\n }\n case 'tool_execution_start': {\n toolCalls += 1;\n const args = JSON.stringify(event.args ?? {}).slice(0, 200);\n logToFile(`[pi] → ${event.toolName} ${args}`);\n // Don't surface raw tool names in the spinner — the anthropic path\n // doesn't, and it reads as noise. The Task panel (syncTodos) is the\n // visible progress, matching the anthropic presentation.\n break;\n }\n case 'tool_execution_end': {\n // Log every result in full, matching the anthropic path's\n // SDK-message logging. Call-only logs make failed runs\n // undiagnosable: a tool can fail (or return something the model\n // misreads) with no trace of what came back.\n logToFile(\n `[pi] ${event.isError ? '✗' : '←'} ${event.toolName}: ${\n typeof event.result === 'string'\n ? event.result\n : JSON.stringify(event.result ?? '')\n }`,\n );\n break;\n }\n case 'agent_end': {\n logToFile(`[pi] agent_end (willRetry=${String(event.willRetry)})`);\n break;\n }\n default:\n break;\n }\n });\n\n // Seed AIO capture with the initial prompt so the first assistant\n // turn's `$ai_input` includes it — pi's subscribe stream doesn't emit\n // a message_end for the initial prompt, only for tool_result user\n // turns that follow.\n capture.setInitialPrompt(prompt);\n\n try {\n // Non-streaming: resolves when the agent run completes. Throws if no\n // model/api key, or on a transport error.\n await agentSession.prompt(prompt);\n\n // Completion guard: pi's prompt() resolves the moment the model returns\n // a turn with no tool call (e.g. a lone [STATUS] line), even mid-plan.\n // While tasks remain open and we're under the cap, nudge it to continue.\n let continueNudges = 0;\n while (\n continueNudges < MAX_CONTINUE_NUDGES &&\n !security.state.criticalViolation &&\n hasOpenTasks(wizardTaskTools.store)\n ) {\n continueNudges += 1;\n logToFile(\n `[pi] completion guard: tasks still open, nudge ${continueNudges}/${MAX_CONTINUE_NUDGES}`,\n );\n await agentSession.prompt(CONTINUE_INSTRUCTION);\n }\n\n // Best-effort remark ask — a failed turn never fails a successful run.\n if (!security.state.criticalViolation) {\n try {\n await agentSession.prompt(REMARK_INSTRUCTION);\n } catch (err) {\n logToFile(`[pi] remark request failed: ${String(err)}`);\n }\n }\n } finally {\n unsubscribe();\n mcpCleanup?.();\n }\n\n // A latched post-scan violation terminates the run as a YARA violation,\n // matching the anthropic path's AgentErrorType.YARA_VIOLATION.\n if (security.state.criticalViolation) {\n spinner.stop('Security violation detected');\n logToFile(\n `[pi] terminated: YARA violation (blocked ${security.state.blockedCount} call(s))`,\n );\n captureAborted();\n return { error: AgentErrorType.YARA_VIOLATION };\n }\n\n // pi ends a run on any tool-call-less turn, so guard against a hollow\n // success reaching the outro (nothing done, or stopped mid-plan).\n const openTasks = hasOpenTasks(wizardTaskTools.store);\n const failure = completionFailure({ toolCalls, openTasks });\n if (failure === AgentErrorType.NO_PROGRESS) {\n spinner.stop('Agent made no changes');\n logToFile(\n `[pi] no progress: ${assistantTurns} assistant turn(s), 0 tool calls`,\n );\n analytics.wizardCapture('agent no progress', {\n assistant_turns: assistantTurns,\n });\n captureAborted();\n return { error: failure };\n }\n if (failure === AgentErrorType.INCOMPLETE_TASKS) {\n spinner.stop('Agent stopped before finishing');\n logToFile('[pi] incomplete: tasks left open');\n analytics.wizardCapture('agent incomplete tasks', { open_tasks: true });\n captureAborted();\n return { error: failure };\n }\n\n const remark = signals.remark();\n if (remark) {\n analytics.capture(WIZARD_REMARK_EVENT_NAME, { remark });\n }\n\n // A failed install_skill is non-fatal — the agent continues best-effort\n // without the skill — but every such run must be measurable.\n const skillFailure = signals.skillInstallFailure();\n if (skillFailure !== undefined) {\n analytics.wizardCapture('agent continued without skill', {\n detail: skillFailure,\n });\n }\n\n // The skill plans events into .posthog-events.json then asks to remove it\n // on completion; pi's `rm` is fence-blocked, so the agent can't — clean it\n // up host-side rather than leave a stale (often empty) artifact (#15).\n try {\n const planFile = path.join(session.installDir, '.posthog-events.json');\n if (fs.existsSync(planFile)) await fs.promises.rm(planFile);\n } catch (err) {\n logToFile(`[pi] .posthog-events.json cleanup skipped: ${String(err)}`);\n }\n\n const stats = agentSession.getSessionStats();\n analytics.wizardCapture('agent completed', {\n ...runDurations(),\n model: modelId,\n num_turns: assistantTurns,\n // API-reported tokens only; no total_cost_usd — the API returns no\n // cost, and $ai_generation already prices the run authoritatively.\n input_tokens: stats.tokens.input,\n output_tokens: stats.tokens.output,\n cache_creation_input_tokens: stats.tokens.cacheWrite,\n cache_read_input_tokens: stats.tokens.cacheRead,\n });\n spinner.stop(config.successMessage ?? 'PostHog integration complete');\n return {};\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n logToFile(`[pi] run error: ${message}`);\n spinner.stop(config.errorMessage ?? `${config.integrationLabel} failed`);\n getUI().log.error(`pi backend error: ${message}`);\n captureAborted();\n\n const lower = message.toLowerCase();\n if (lower.includes('rate limit') || lower.includes('429')) {\n return { error: AgentErrorType.RATE_LIMIT, message };\n }\n return { error: AgentErrorType.API_ERROR, message };\n }\n },\n\n // Orchestrator mode: one fresh pi session per seed plan / drained task, with\n // the in-process queue tools registered as pi custom tools. Lazily imported —\n // task.ts pulls in typebox (ESM), which must stay out of the static module\n // graph so CommonJS unit tests can load the backend seam without parsing it.\n async runTask(inputs: TaskRunInputs): Promise<AgentResult> {\n const { runPiTask } = await import('./task');\n return runPiTask(inputs);\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAM,QAAQ,MAAqB,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3
- import "./wizard-session-BAZql11N.js";
4
- import { m as Icons, p as Colors } from "./posthog-integration-BA2aFHGz.js";
5
- import { a as ConfirmButton, b as getContentBlocks, f as getProgramConfig, t as PickerMenu, u as PROGRAM_REGISTRY } from "./bin.js";
6
- import { t as WizardStore } from "./store-Cp_jvnNp.js";
7
- import { A as ConfirmationInput, C as TabContainer, E as LogViewer, F as SplitView, I as CardLayout, N as ProgressList, P as LoadingBox, S as HNViewer, T as EventPlanViewer, b as LearnCard, c as SlackConnectScreen, d as AuditChecksViewer, f as McpSuggestedPromptsScreen, h as IssueTable, j as GroupedPickerMenu, k as ModalOverlay, l as AUDIT_AREA_SLIDES, m as McpScreen, n as releaseTerminal, o as OutroScreen, p as TAILORED_ROLES, r as AiOptInRequiredScreen, t as enterDarkTerminal, v as ServiceHealthList, w as ScreenContainer, x as ContentSequencer, y as TipsCard } from "./terminal-D4A6Hmkf.js";
1
+ import { ht as VERSION, l as WIZARD_LOG_FILE, v as getBlockingServiceKeys } from "./debug-CbgLkSCY.js";
2
+ import { s as HostResolution } from "./setup-utils-6qyTDNyd.js";
3
+ import "./wizard-session-CwgR5y3-.js";
4
+ import { h as Icons, m as Colors } from "./posthog-integration-Dy5cNPaa.js";
5
+ import { d as PROGRAM_REGISTRY, o as ConfirmButton, p as getProgramConfig, t as PickerMenu, x as getContentBlocks } from "./bin.js";
6
+ import { t as WizardStore } from "./store-sIaF89XA.js";
7
+ import { A as LogViewer, C as TipsCard, D as TabContainer, E as HNViewer, F as GroupedPickerMenu, I as ProgressList, L as LoadingBox, N as ModalOverlay, O as ScreenContainer, P as ConfirmationInput, R as SplitView, S as ServiceHealthList, T as ContentSequencer, _ as TAILORED_ROLES, c as SlackConnectScreen, d as AuditChecksViewer, h as assembleProfile, k as EventPlanViewer, l as AUDIT_AREA_SLIDES, m as McpSuggestedPromptsScreen, n as releaseTerminal, o as OutroScreen, p as seededProfile, r as AiOptInRequiredScreen, t as enterDarkTerminal, v as McpScreen, w as LearnCard, y as IssueTable, z as CardLayout } from "./terminal-vo5Zl7j1.js";
8
8
  import * as fs$1 from "fs";
9
9
  import * as path$1 from "path";
10
10
  import * as os from "os";
@@ -146,6 +146,48 @@ const LayoutDemo = () => {
146
146
  /**
147
147
  * InputDemo — Demonstrates PickerMenu (single + multi) and ConfirmationInput.
148
148
  */
149
+ const LONG_OPTIONS = [
150
+ "None of these",
151
+ "GitHub Issues",
152
+ "Linear",
153
+ "Jira",
154
+ "GitLab",
155
+ "Gitea",
156
+ "Shortcut",
157
+ "Sentry",
158
+ "Rollbar",
159
+ "Bugsnag",
160
+ "Honeybadger",
161
+ "Raygun",
162
+ "Zendesk",
163
+ "Freshdesk",
164
+ "Freshservice",
165
+ "Front",
166
+ "Gorgias",
167
+ "Kustomer",
168
+ "Dixa",
169
+ "Plain",
170
+ "pganalyze",
171
+ "Snyk",
172
+ "SonarQube",
173
+ "Semgrep",
174
+ "Rapid7 InsightVM",
175
+ "Featurebase",
176
+ "Frill",
177
+ "Aha",
178
+ "UserVoice",
179
+ "Productboard",
180
+ "Canny",
181
+ "AskNicely",
182
+ "Retently",
183
+ "Appfigures",
184
+ "AppFollow",
185
+ "Judge.me",
186
+ "Google Search Console"
187
+ ].map((label) => ({
188
+ label,
189
+ value: label.toLowerCase().replace(/\s+/g, "-")
190
+ }));
149
191
  const InputDemo = () => {
150
192
  const [step, setStep] = useState("single");
151
193
  const [results, setResults] = useState([]);
@@ -217,6 +259,27 @@ const InputDemo = () => {
217
259
  onSelect: (values) => {
218
260
  const arr = Array.isArray(values) ? values : [values];
219
261
  setResults((prev) => [...prev, `Multi: ${arr.join(", ")}`]);
262
+ setStep("multi-long");
263
+ }
264
+ })
265
+ ]
266
+ });
267
+ if (step === "multi-long") return /* @__PURE__ */ jsxs(Box, {
268
+ flexDirection: "column",
269
+ children: [
270
+ /* @__PURE__ */ jsx(Text, {
271
+ bold: true,
272
+ color: Colors.accent,
273
+ children: "Input Demo — Multi Select (long, scrolls)"
274
+ }),
275
+ /* @__PURE__ */ jsx(Box, { height: 1 }),
276
+ /* @__PURE__ */ jsx(PickerMenu, {
277
+ message: "Which of these do you use? (↑/↓ to scroll)",
278
+ mode: "multi",
279
+ options: LONG_OPTIONS,
280
+ onSelect: (values) => {
281
+ const arr = Array.isArray(values) ? values : [values];
282
+ setResults((prev) => [...prev, `Multi (long): ${arr.length} picked`]);
220
283
  setStep("confirm");
221
284
  }
222
285
  })
@@ -1742,13 +1805,17 @@ const McpDemo = ({ store }) => {
1742
1805
  * suggested-prompts screen.
1743
1806
  *
1744
1807
  * Mounts the real McpSuggestedPromptsScreen with mock services so every
1745
- * phase (Choose → Authenticating → Greeting → PromptPicker → Running →
1746
- * FollowUp) can be previewed without touching the network. The Greeting
1747
- * phase auto-advances; FollowUp re-enters Running when a follow-up is
1748
- * picked, building a conversation tree up to MAX_PROMPT_RUNS deep.
1808
+ * phase (Choose → Authenticating → Scouting → [SeedOffer → Seeding] →
1809
+ * Greeting → PromptPicker → Running → FollowUp → Goodbye) can be previewed
1810
+ * without touching the network. The Greeting phase auto-advances; FollowUp
1811
+ * re-enters Running when a follow-up is picked, building a conversation
1812
+ * tree up to MAX_PROMPT_RUNS deep.
1749
1813
  *
1750
1814
  * R cycle role (null → founder → product → ... → data → null)
1751
1815
  * F cycle framework (null → nextjs → vue → swift → django → null)
1816
+ * T cycle data tier (rich → sparse → empty) — drives the scout:
1817
+ * rich → generated quests from real events;
1818
+ * empty → seed-offer fork; sparse → safe read.
1752
1819
  * X remount the screen (useful after Exit)
1753
1820
  *
1754
1821
  * O OAuth outcome: success | error
@@ -1756,11 +1823,14 @@ const McpDemo = ({ store }) => {
1756
1823
  * S stream script: short-text | with-tools | mid-stream-error
1757
1824
  * C chunk delay: 50ms | 200ms | 800ms
1758
1825
  *
1759
- * Tip: switch S to "with-tools" and the FollowUp picker after the run
1760
- * will show context-aware suggestions based on the last tool. The mock
1761
- * calls are CLI-mode `exec` chunks (`mcp__posthog-wizard__exec` + a
1762
- * `call <tool> …` command), so they exercise getFollowUps' inner-tool
1763
- * extraction.
1826
+ * Tips:
1827
+ * - Set T to "empty" to walk the seed-events fork (SeedOffer → Seeding),
1828
+ * which lands on a rich seeded profile.
1829
+ * - Switch S to "with-tools" and the FollowUp picker after the run will
1830
+ * show context-aware suggestions based on the last tool. The mock
1831
+ * calls are CLI-mode `exec` chunks (`mcp__posthog-wizard__exec` + a
1832
+ * `call <tool> …` command), so they exercise getFollowUps' inner-tool
1833
+ * extraction.
1764
1834
  */
1765
1835
  const FAMILY_INTEGRATIONS = [
1766
1836
  null,
@@ -1780,6 +1850,50 @@ const CHUNK_DELAYS_MS = [
1780
1850
  200,
1781
1851
  800
1782
1852
  ];
1853
+ const PROBE_TIER_CYCLE = [
1854
+ "rich",
1855
+ "sparse",
1856
+ "empty"
1857
+ ];
1858
+ const NO_PRODUCTS = {
1859
+ sessionReplay: false,
1860
+ surveys: false,
1861
+ featureFlags: false,
1862
+ experiments: false,
1863
+ dataWarehouse: false
1864
+ };
1865
+ function mockProfile(tier) {
1866
+ if (tier === "empty") return assembleProfile([], NO_PRODUCTS);
1867
+ if (tier === "sparse") return assembleProfile([{
1868
+ name: "$pageview",
1869
+ count: 12
1870
+ }, {
1871
+ name: "clicked",
1872
+ count: 5
1873
+ }], NO_PRODUCTS);
1874
+ return assembleProfile([
1875
+ {
1876
+ name: "$pageview",
1877
+ count: 100
1878
+ },
1879
+ {
1880
+ name: "feature_used",
1881
+ count: 21
1882
+ },
1883
+ {
1884
+ name: "signed_up",
1885
+ count: 10
1886
+ },
1887
+ {
1888
+ name: "activated",
1889
+ count: 7
1890
+ },
1891
+ {
1892
+ name: "upgraded_to_paid",
1893
+ count: 3
1894
+ }
1895
+ ], NO_PRODUCTS);
1896
+ }
1783
1897
  const LOGIN_OUTCOMES = ["success", "error"];
1784
1898
  const STREAM_SCRIPTS = [
1785
1899
  "short-text",
@@ -1919,7 +2033,15 @@ function createMockServices(store, configRef) {
1919
2033
  }
1920
2034
  };
1921
2035
  },
1922
- runPromptStreaming: ({ signal }) => mockStream(configRef, signal)
2036
+ runPromptStreaming: ({ signal }) => mockStream(configRef, signal),
2037
+ probeProjectData: async () => {
2038
+ await delay(800);
2039
+ return mockProfile(configRef.current.tier);
2040
+ },
2041
+ seedDemoEvents: async ({ baseProfile }) => {
2042
+ await delay(1500);
2043
+ return seededProfile(baseProfile, /* @__PURE__ */ new Date());
2044
+ }
1923
2045
  };
1924
2046
  }
1925
2047
  async function* mockStream(configRef, signal) {
@@ -1935,6 +2057,7 @@ async function* mockStream(configRef, signal) {
1935
2057
  const McpSuggestedPromptsDemo = ({ store }) => {
1936
2058
  const [roleIdx, setRoleIdx] = useState(2);
1937
2059
  const [familyIdx, setFamilyIdx] = useState(1);
2060
+ const [tierIdx, setTierIdx] = useState(0);
1938
2061
  const [resetKey, setResetKey] = useState(0);
1939
2062
  const [loginOutcomeIdx, setLoginOutcomeIdx] = useState(0);
1940
2063
  const [loginDelayIdx, setLoginDelayIdx] = useState(1);
@@ -1942,12 +2065,14 @@ const McpSuggestedPromptsDemo = ({ store }) => {
1942
2065
  const [chunkDelayIdx, setChunkDelayIdx] = useState(1);
1943
2066
  const role = ROLE_CYCLE[roleIdx];
1944
2067
  const integration = FAMILY_INTEGRATIONS[familyIdx];
2068
+ const tier = PROBE_TIER_CYCLE[tierIdx];
1945
2069
  const loginOutcome = LOGIN_OUTCOMES[loginOutcomeIdx];
1946
2070
  const loginDelayMs = LOGIN_DELAYS_MS[loginDelayIdx];
1947
2071
  const script = STREAM_SCRIPTS[scriptIdx];
1948
2072
  const chunkDelayMs = CHUNK_DELAYS_MS[chunkDelayIdx];
1949
2073
  const configRef = useRef({
1950
2074
  role,
2075
+ tier,
1951
2076
  loginOutcome,
1952
2077
  loginDelayMs,
1953
2078
  script,
@@ -1955,6 +2080,7 @@ const McpSuggestedPromptsDemo = ({ store }) => {
1955
2080
  });
1956
2081
  configRef.current = {
1957
2082
  role,
2083
+ tier,
1958
2084
  loginOutcome,
1959
2085
  loginDelayMs,
1960
2086
  script,
@@ -1972,6 +2098,9 @@ const McpSuggestedPromptsDemo = ({ store }) => {
1972
2098
  } else if (input === "F" || input === "f") {
1973
2099
  setFamilyIdx((i) => (i + 1) % FAMILY_INTEGRATIONS.length);
1974
2100
  setResetKey((k) => k + 1);
2101
+ } else if (input === "T" || input === "t") {
2102
+ setTierIdx((i) => (i + 1) % PROBE_TIER_CYCLE.length);
2103
+ setResetKey((k) => k + 1);
1975
2104
  } else if (input === "X" || input === "x") {
1976
2105
  store.setCredentials(null);
1977
2106
  store.setRoleAtOrganization(null);
@@ -1988,7 +2117,7 @@ const McpSuggestedPromptsDemo = ({ store }) => {
1988
2117
  children: [
1989
2118
  /* @__PURE__ */ jsx(Text, {
1990
2119
  dimColor: true,
1991
- children: "R role · F framework · X reset · O oauth · L login-delay · S script · C chunk-delay"
2120
+ children: "R role · F framework · T data-tier · X reset · O oauth · L login-delay · S script · C chunk-delay"
1992
2121
  }),
1993
2122
  /* @__PURE__ */ jsxs(Text, {
1994
2123
  dimColor: true,
@@ -1997,6 +2126,8 @@ const McpSuggestedPromptsDemo = ({ store }) => {
1997
2126
  String(role),
1998
2127
  " · integration=",
1999
2128
  integration ?? "unknown",
2129
+ " · tier=",
2130
+ tier,
2000
2131
  " · login=",
2001
2132
  loginOutcome,
2002
2133
  "/",
@@ -2706,6 +2837,205 @@ const AiOptInDemo = ({ variant }) => {
2706
2837
  });
2707
2838
  };
2708
2839
  //#endregion
2840
+ //#region src/ui/tui/playground/demos/AskModalDemo.tsx
2841
+ /**
2842
+ * AskModalDemo — Pickers rendered inside an ask-style ModalOverlay, the way
2843
+ * WizardAskScreen composes them: prompt paragraph in the modal body, then a
2844
+ * label-less PickerMenu. Exercises the viewport height cap (MAX_LIST_ROWS)
2845
+ * and the no-label spacing (no stray blank lines under the paragraph).
2846
+ */
2847
+ const DESCRIBED_OPTIONS = [
2848
+ {
2849
+ label: "Session replay",
2850
+ value: "replay",
2851
+ description: "Record and replay real user sessions to see exactly what happened before an error or a rage click."
2852
+ },
2853
+ {
2854
+ label: "Feature flags",
2855
+ value: "flags",
2856
+ description: "Roll features out gradually, target by cohort, and kill misbehaving code paths without a deploy."
2857
+ },
2858
+ {
2859
+ label: "Error tracking",
2860
+ value: "errors",
2861
+ description: "Capture exceptions with stack traces and source maps."
2862
+ }
2863
+ ];
2864
+ const GROUPED = {
2865
+ "Issue trackers": [
2866
+ {
2867
+ label: "GitHub Issues",
2868
+ value: "github"
2869
+ },
2870
+ {
2871
+ label: "Linear",
2872
+ value: "linear"
2873
+ },
2874
+ {
2875
+ label: "Jira",
2876
+ value: "jira"
2877
+ },
2878
+ {
2879
+ label: "Shortcut",
2880
+ value: "shortcut"
2881
+ }
2882
+ ],
2883
+ "Error monitoring": [
2884
+ {
2885
+ label: "Sentry",
2886
+ value: "sentry"
2887
+ },
2888
+ {
2889
+ label: "Rollbar",
2890
+ value: "rollbar"
2891
+ },
2892
+ {
2893
+ label: "Bugsnag",
2894
+ value: "bugsnag"
2895
+ },
2896
+ {
2897
+ label: "Honeybadger",
2898
+ value: "honeybadger"
2899
+ }
2900
+ ],
2901
+ "Support desks": [
2902
+ {
2903
+ label: "Zendesk",
2904
+ value: "zendesk"
2905
+ },
2906
+ {
2907
+ label: "Freshdesk",
2908
+ value: "freshdesk"
2909
+ },
2910
+ {
2911
+ label: "Front",
2912
+ value: "front"
2913
+ },
2914
+ {
2915
+ label: "Intercom",
2916
+ value: "intercom"
2917
+ }
2918
+ ],
2919
+ Observability: [
2920
+ {
2921
+ label: "Datadog",
2922
+ value: "datadog"
2923
+ },
2924
+ {
2925
+ label: "New Relic",
2926
+ value: "newrelic"
2927
+ },
2928
+ {
2929
+ label: "Grafana",
2930
+ value: "grafana"
2931
+ },
2932
+ {
2933
+ label: "Splunk",
2934
+ value: "splunk"
2935
+ }
2936
+ ]
2937
+ };
2938
+ /** Mirrors WizardAskScreen's shape: paragraph body, then a label-less input. */
2939
+ const AskModal = ({ prompt, children }) => /* @__PURE__ */ jsxs(ModalOverlay, {
2940
+ borderColor: Colors.accent,
2941
+ title: `${Icons.diamond} self-driving-setup`,
2942
+ titleColor: Colors.accent,
2943
+ width: 72,
2944
+ children: [/* @__PURE__ */ jsx(Box, {
2945
+ flexDirection: "column",
2946
+ children: /* @__PURE__ */ jsx(Text, { children: prompt })
2947
+ }), /* @__PURE__ */ jsx(Box, {
2948
+ marginTop: 1,
2949
+ children
2950
+ })]
2951
+ });
2952
+ const AskModalDemo = () => {
2953
+ const [step, setStep] = useState("multi-long");
2954
+ const [results, setResults] = useState([]);
2955
+ const advance = (result, next) => {
2956
+ setResults((prev) => [...prev, result]);
2957
+ setStep(next);
2958
+ };
2959
+ if (step === "multi-long") return /* @__PURE__ */ jsx(AskModal, {
2960
+ prompt: "Self-driving can also watch your other tools and investigate and fix the problems they surface. Which of these do you use?",
2961
+ children: /* @__PURE__ */ jsx(PickerMenu, {
2962
+ mode: "multi",
2963
+ options: LONG_OPTIONS,
2964
+ onSelect: (values) => {
2965
+ advance(`Multi (long): ${(Array.isArray(values) ? values : [values]).length} picked`, "multi-descriptions");
2966
+ }
2967
+ }, step)
2968
+ });
2969
+ if (step === "multi-descriptions") return /* @__PURE__ */ jsx(AskModal, {
2970
+ prompt: "Besides analytics, which PostHog products should the agent set up while it's in the codebase?",
2971
+ children: /* @__PURE__ */ jsx(PickerMenu, {
2972
+ mode: "multi",
2973
+ optionMarginBottom: 1,
2974
+ options: DESCRIBED_OPTIONS,
2975
+ onSelect: (values) => {
2976
+ advance(`Multi (descriptions): ${(Array.isArray(values) ? values : [values]).join(", ") || "none"}`, "single");
2977
+ }
2978
+ }, step)
2979
+ });
2980
+ if (step === "single") return /* @__PURE__ */ jsx(AskModal, {
2981
+ prompt: "Your project has both an app and a marketing site. Which one should the agent instrument first?",
2982
+ children: /* @__PURE__ */ jsx(PickerMenu, {
2983
+ options: [
2984
+ {
2985
+ label: "The app",
2986
+ value: "app",
2987
+ hint: "src/app"
2988
+ },
2989
+ {
2990
+ label: "The marketing site",
2991
+ value: "marketing",
2992
+ hint: "www/"
2993
+ },
2994
+ {
2995
+ label: "Both, app first",
2996
+ value: "both"
2997
+ }
2998
+ ],
2999
+ onSelect: (value) => {
3000
+ advance(`Single: ${String(value)}`, "grouped");
3001
+ }
3002
+ })
3003
+ });
3004
+ if (step === "grouped") return /* @__PURE__ */ jsx(AskModal, {
3005
+ prompt: "Grouped variant of the same ask — categories with headers, everything pre-selected:",
3006
+ children: /* @__PURE__ */ jsx(GroupedPickerMenu, {
3007
+ groups: GROUPED,
3008
+ onSelect: (values) => {
3009
+ advance(`Grouped: ${values.length} kept`, "done");
3010
+ }
3011
+ })
3012
+ });
3013
+ return /* @__PURE__ */ jsxs(Box, {
3014
+ flexDirection: "column",
3015
+ children: [
3016
+ /* @__PURE__ */ jsx(Text, {
3017
+ bold: true,
3018
+ color: Colors.accent,
3019
+ children: "Ask Modal Demo — Results"
3020
+ }),
3021
+ /* @__PURE__ */ jsx(Box, { height: 1 }),
3022
+ results.map((r, i) => /* @__PURE__ */ jsxs(Text, {
3023
+ color: Colors.success,
3024
+ children: [
3025
+ "✔",
3026
+ " ",
3027
+ r
3028
+ ]
3029
+ }, i)),
3030
+ /* @__PURE__ */ jsx(Box, { height: 1 }),
3031
+ /* @__PURE__ */ jsx(Text, {
3032
+ dimColor: true,
3033
+ children: "Switch away from this tab and back to restart."
3034
+ })
3035
+ ]
3036
+ });
3037
+ };
3038
+ //#endregion
2709
3039
  //#region src/ui/tui/playground/PlaygroundApp.tsx
2710
3040
  /**
2711
3041
  * PlaygroundApp — Root component for the primitives playground.
@@ -2730,6 +3060,11 @@ const PlaygroundApp = ({ store }) => {
2730
3060
  label: "Input",
2731
3061
  component: /* @__PURE__ */ jsx(InputDemo, {})
2732
3062
  },
3063
+ {
3064
+ id: "ask-modal",
3065
+ label: "Ask modal",
3066
+ component: /* @__PURE__ */ jsx(AskModalDemo, {})
3067
+ },
2733
3068
  {
2734
3069
  id: "progress",
2735
3070
  label: "Progress",
@@ -2843,4 +3178,4 @@ function runPlayground() {
2843
3178
  //#endregion
2844
3179
  export { runPlayground };
2845
3180
 
2846
- //# sourceMappingURL=playground-B4yTvjn4.js.map
3181
+ //# sourceMappingURL=playground-DuBvnGkP.js.map