@posthog/wizard 2.78.0 → 2.79.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +20 -11
  2. package/dist/PickerMenu-dG5DQCZA.js +758 -0
  3. package/dist/PickerMenu-dG5DQCZA.js.map +1 -0
  4. package/dist/{add-mcp-server-to-clients-JMv8LP-O.js → add-mcp-server-to-clients-DIaTRWMY.js} +7 -18
  5. package/dist/{add-mcp-server-to-clients-JMv8LP-O.js.map → add-mcp-server-to-clients-DIaTRWMY.js.map} +1 -1
  6. package/dist/add-mcp-server-to-clients-artmN7mz.js +2 -0
  7. package/dist/agent-BEjARD2a.js +6 -0
  8. package/dist/{agent-bCZ3i3fh.js → agent-BWFhuLgo.js} +131 -38
  9. package/dist/agent-BWFhuLgo.js.map +1 -0
  10. package/dist/{agent-interface-BAOIHuXS.js → agent-interface-FkbaBJwz.js} +66 -28
  11. package/dist/agent-interface-FkbaBJwz.js.map +1 -0
  12. package/dist/{agent-prompt-loader-7Pd4CfZO.js → agent-prompt-loader-D0weQ-7k.js} +5 -5
  13. package/dist/{agent-prompt-loader-7Pd4CfZO.js.map → agent-prompt-loader-D0weQ-7k.js.map} +1 -1
  14. package/dist/analytics-DFtbRjYh.js +2 -0
  15. package/dist/{analytics-CHCZ_qUR.js → analytics-DXK1gc12.js} +4 -4
  16. package/dist/{analytics-CHCZ_qUR.js.map → analytics-DXK1gc12.js.map} +1 -1
  17. package/dist/api-Cm9UtKZh.js +2 -0
  18. package/dist/{api-Diy_2fp8.js → api-CrbCIQOz.js} +4 -16
  19. package/dist/{api-Diy_2fp8.js.map → api-CrbCIQOz.js.map} +1 -1
  20. package/dist/bin.js +5 -2957
  21. package/dist/bin.js.map +1 -1
  22. package/dist/{bounded-fs-Bx9zTe6m.js → bounded-fs-vAq-T-K7.js} +3 -3
  23. package/dist/{bounded-fs-Bx9zTe6m.js.map → bounded-fs-vAq-T-K7.js.map} +1 -1
  24. package/dist/{ci-install-CDdQYsPe.js → ci-install-COcV8SY2.js} +8 -7
  25. package/dist/ci-install-COcV8SY2.js.map +1 -0
  26. package/dist/{constants-jFI2SaE1.js → constants-DHCBSfnx.js} +3 -3
  27. package/dist/{constants-jFI2SaE1.js.map → constants-DHCBSfnx.js.map} +1 -1
  28. package/dist/{debug-M2gV2iDq.js → debug-BuYHGr6_.js} +1 -1
  29. package/dist/{debug-Ch4BDOtD.js → debug-kAHwWGg7.js} +2 -2
  30. package/dist/{debug-Ch4BDOtD.js.map → debug-kAHwWGg7.js.map} +1 -1
  31. package/dist/{defaults-C6J7yL4O.js → defaults-a9TelDhJ.js} +1 -1
  32. package/dist/{defaults-C6J7yL4O.js.map → defaults-a9TelDhJ.js.map} +1 -1
  33. package/dist/emit-BSetXzDV.js +69 -0
  34. package/dist/emit-BSetXzDV.js.map +1 -0
  35. package/dist/{endpoints-DCVbM06L.js → endpoints-BVMYm9F4.js} +3 -3
  36. package/dist/{endpoints-DCVbM06L.js.map → endpoints-BVMYm9F4.js.map} +1 -1
  37. package/dist/{env-api-key-Qx8NnYHm.js → env-api-key-BP-NFFXt.js} +3 -5
  38. package/dist/{env-api-key-Qx8NnYHm.js.map → env-api-key-BP-NFFXt.js.map} +1 -1
  39. package/dist/env-api-key-CaWEDj_9.js +2 -0
  40. package/dist/{environment-B07Bmxae.js → environment-BATlQxcQ.js} +5 -10
  41. package/dist/{environment-B07Bmxae.js.map → environment-BATlQxcQ.js.map} +1 -1
  42. package/dist/environment-CwD8OPYj.js +2 -0
  43. package/dist/errors-C2domSkK.js +79 -0
  44. package/dist/errors-C2domSkK.js.map +1 -0
  45. package/dist/file-C5JMsyR1.js +2 -0
  46. package/dist/{file-BcLTjU16.js → file-DcRKycV8.js} +4 -4
  47. package/dist/file-DcRKycV8.js.map +1 -0
  48. package/dist/{file-watcher-DWc_bTs6.js → file-watcher-Brq2nnHV.js} +2 -2
  49. package/dist/{file-watcher-DWc_bTs6.js.map → file-watcher-Brq2nnHV.js.map} +1 -1
  50. package/dist/{gateway-CjoShdLa.js → gateway-C9-GlLO9.js} +39 -8
  51. package/dist/gateway-C9-GlLO9.js.map +1 -0
  52. package/dist/{headless-ui-BFFmYC4v.js → headless-ui-CqI2gXlD.js} +2 -2
  53. package/dist/{headless-ui-BFFmYC4v.js.map → headless-ui-CqI2gXlD.js.map} +1 -1
  54. package/dist/{interactive-D6zV7brJ.js → interactive-B_Ti_CsS.js} +3 -3
  55. package/dist/interactive-B_Ti_CsS.js.map +1 -0
  56. package/dist/{logging-ui-_TwoMNbG.js → logging-ui-Dza4D0MK.js} +5 -5
  57. package/dist/{logging-ui-_TwoMNbG.js.map → logging-ui-Dza4D0MK.js.map} +1 -1
  58. package/dist/main-CgKxbwMP.js +1396 -0
  59. package/dist/main-CgKxbwMP.js.map +1 -0
  60. package/dist/{mcp-DAgaoGk5.js → mcp-DnAyW0-w.js} +4 -4
  61. package/dist/{mcp-DAgaoGk5.js.map → mcp-DnAyW0-w.js.map} +1 -1
  62. package/dist/{mcp-prompt-streaming-I2U_X7BC.js → mcp-prompt-streaming-DDWQ-FCA.js} +6 -6
  63. package/dist/mcp-prompt-streaming-DDWQ-FCA.js.map +1 -0
  64. package/dist/{mint-failure-D4nd2XmZ.js → mint-failure-u8xQKNOn.js} +689 -126
  65. package/dist/mint-failure-u8xQKNOn.js.map +1 -0
  66. package/dist/{models-DDdBJKwT.js → models-WcwUnSKb.js} +2 -2
  67. package/dist/{models-DDdBJKwT.js.map → models-WcwUnSKb.js.map} +1 -1
  68. package/dist/{non-interactive-Dzow7YKY.js → non-interactive-DyVC1AGc.js} +4 -3
  69. package/dist/{non-interactive-Dzow7YKY.js.map → non-interactive-DyVC1AGc.js.map} +1 -1
  70. package/dist/{oauth-session-DJ8h6GFa.js → oauth-session-DYM2Hrl2.js} +2 -2
  71. package/dist/{oauth-session-DJ8h6GFa.js.map → oauth-session-DYM2Hrl2.js.map} +1 -1
  72. package/dist/{orchestrator-tools-szcdscwn.js → orchestrator-tools-DbgNBFGA.js} +3 -3
  73. package/dist/{orchestrator-tools-szcdscwn.js.map → orchestrator-tools-DbgNBFGA.js.map} +1 -1
  74. package/dist/{package-json-DY70kkNp.js → package-json-Atg34fa4.js} +2 -8
  75. package/dist/{package-json-DY70kkNp.js.map → package-json-Atg34fa4.js.map} +1 -1
  76. package/dist/package-json-D8Ga03tK.js +2 -0
  77. package/dist/{pi-D3h5Ok0i.js → pi-8KsYsPmM.js} +145 -45
  78. package/dist/pi-8KsYsPmM.js.map +1 -0
  79. package/dist/{playground-5AB4WgNF.js → playground-BlYRBMj7.js} +11 -11
  80. package/dist/playground-BlYRBMj7.js.map +1 -0
  81. package/dist/{posthog-DNn574nW.js → posthog-Bt0Aplb8.js} +4 -9
  82. package/dist/posthog-Bt0Aplb8.js.map +1 -0
  83. package/dist/posthog-CUgCEhH0.js +2 -0
  84. package/dist/{provisioning-B8uSqRZk.js → provisioning-Bo2NRxFz.js} +5 -11
  85. package/dist/{provisioning-B8uSqRZk.js.map → provisioning-Bo2NRxFz.js.map} +1 -1
  86. package/dist/provisioning-OGFGlzf7.js +2 -0
  87. package/dist/{queue-tools-9OOVx5TE.js → queue-tools-C8mXOh7e.js} +3 -3
  88. package/dist/{queue-tools-9OOVx5TE.js.map → queue-tools-C8mXOh7e.js.map} +1 -1
  89. package/dist/registry-C06e_x-p.js +2 -0
  90. package/dist/{registry-8YG-kuXk.js → registry-CD5RQt38.js} +51 -53
  91. package/dist/registry-CD5RQt38.js.map +1 -0
  92. package/dist/run-agent-legacy-ChacZImU.js +2 -0
  93. package/dist/{run-agent-legacy-d7rWlzQR.js → run-agent-legacy-DOlM6DQu.js} +823 -1022
  94. package/dist/run-agent-legacy-DOlM6DQu.js.map +1 -0
  95. package/dist/runners-ov3EXF1n.js +834 -0
  96. package/dist/runners-ov3EXF1n.js.map +1 -0
  97. package/dist/{security-Cg_4a7vB.js → security-C71pkwqH.js} +16 -6
  98. package/dist/security-C71pkwqH.js.map +1 -0
  99. package/dist/{setup-utils-CmTCTPkX.js → setup-utils-B26Lf2yF.js} +12 -22
  100. package/dist/setup-utils-B26Lf2yF.js.map +1 -0
  101. package/dist/setup-utils-CVS86NYR.js +2 -0
  102. package/dist/{start-tui-CB2PZs1x.js → start-tui-Bo2L0bar.js} +30 -28
  103. package/dist/start-tui-Bo2L0bar.js.map +1 -0
  104. package/dist/{steps-BZcXRJNY.js → steps-BPcg3_3Q.js} +7 -7
  105. package/dist/{steps-BZcXRJNY.js.map → steps-BPcg3_3Q.js.map} +1 -1
  106. package/dist/{store-UN7c-ASf.js → store-BTzcvRGT.js} +12 -18
  107. package/dist/store-BTzcvRGT.js.map +1 -0
  108. package/dist/store-BpqySPXm.js +5 -0
  109. package/dist/{subagent-BofIDK-O.js → subagent-D1TrTchE.js} +3 -3
  110. package/dist/{subagent-BofIDK-O.js.map → subagent-D1TrTchE.js.map} +1 -1
  111. package/dist/{task-r9t1UhQP.js → task-DqRlQBfs.js} +18 -16
  112. package/dist/task-DqRlQBfs.js.map +1 -0
  113. package/dist/{task-stream-CMUilu54.js → task-stream-Bw6JaLCX.js} +10 -10
  114. package/dist/task-stream-Bw6JaLCX.js.map +1 -0
  115. package/dist/{tasks-Bbv_lOBG.js → tasks-ChWufsdO.js} +1 -1
  116. package/dist/{tasks-Bbv_lOBG.js.map → tasks-ChWufsdO.js.map} +1 -1
  117. package/dist/{telemetry-D6ruCtnv.js → telemetry-B7zJdRmA.js} +3 -3
  118. package/dist/{telemetry-D6ruCtnv.js.map → telemetry-B7zJdRmA.js.map} +1 -1
  119. package/dist/{terminal-DrGyci_a.js → terminal-zgkEfoCL.js} +17 -17
  120. package/dist/terminal-zgkEfoCL.js.map +1 -0
  121. package/dist/{tools-Dyfh9aCD.js → tools-CkJ2y9Wt.js} +9 -9
  122. package/dist/tools-CkJ2y9Wt.js.map +1 -0
  123. package/dist/{ui-BBVuTM1v.js → ui-Q6-RvERF.js} +3 -3
  124. package/dist/{ui-BBVuTM1v.js.map → ui-Q6-RvERF.js.map} +1 -1
  125. package/dist/{version-aXxpgRKx.js → version-CHhJjz_H.js} +2 -2
  126. package/dist/{version-aXxpgRKx.js.map → version-CHhJjz_H.js.map} +1 -1
  127. package/dist/{wizard-abort-BBkiUxfS.js → wizard-abort-BPdv07np.js} +7 -6
  128. package/dist/{wizard-abort-BBkiUxfS.js.map → wizard-abort-BPdv07np.js.map} +1 -1
  129. package/dist/wizard-abort-Br1qMDNa.js +3 -0
  130. package/dist/wizard-session-2w4Ru-Wz.js.map +1 -1
  131. package/dist/{wizard-ui-DoyOZxK8.js → wizard-ui-DVqrYaOM.js} +1 -1
  132. package/dist/{wizard-ui-DoyOZxK8.js.map → wizard-ui-DVqrYaOM.js.map} +1 -1
  133. package/dist/{yara-hooks-DCeMDd1o.js → yara-hooks-BnxejtXK.js} +5 -5
  134. package/dist/{yara-hooks-DCeMDd1o.js.map → yara-hooks-BnxejtXK.js.map} +1 -1
  135. package/dist/yara-hooks-DSuExwb4.js +2 -0
  136. package/package.json +2 -1
  137. package/dist/agent-bCZ3i3fh.js.map +0 -1
  138. package/dist/agent-interface-BAOIHuXS.js.map +0 -1
  139. package/dist/analytics-BcV-WCM4.js +0 -2
  140. package/dist/ci-install-CDdQYsPe.js.map +0 -1
  141. package/dist/errors-CQ9kttJD.js +0 -185
  142. package/dist/errors-CQ9kttJD.js.map +0 -1
  143. package/dist/file-BcLTjU16.js.map +0 -1
  144. package/dist/gateway-CjoShdLa.js.map +0 -1
  145. package/dist/interactive-D6zV7brJ.js.map +0 -1
  146. package/dist/mcp-prompt-streaming-I2U_X7BC.js.map +0 -1
  147. package/dist/mint-failure-D4nd2XmZ.js.map +0 -1
  148. package/dist/pi-D3h5Ok0i.js.map +0 -1
  149. package/dist/playground-5AB4WgNF.js.map +0 -1
  150. package/dist/posthog-DNn574nW.js.map +0 -1
  151. package/dist/registry-8YG-kuXk.js.map +0 -1
  152. package/dist/rolldown-runtime-B_-DWIq7.js +0 -15
  153. package/dist/run-agent-legacy-d7rWlzQR.js.map +0 -1
  154. package/dist/security-Cg_4a7vB.js.map +0 -1
  155. package/dist/setup-utils-CmTCTPkX.js.map +0 -1
  156. package/dist/start-tui-CB2PZs1x.js.map +0 -1
  157. package/dist/store-UN7c-ASf.js.map +0 -1
  158. package/dist/task-r9t1UhQP.js.map +0 -1
  159. package/dist/task-stream-CMUilu54.js.map +0 -1
  160. package/dist/terminal-DrGyci_a.js.map +0 -1
  161. package/dist/tools-Dyfh9aCD.js.map +0 -1
  162. package/dist/wizard-abort-BU4aLyvh.js +0 -3
  163. package/dist/yara-hooks-DSGuCU9A.js +0 -2
@@ -1,14 +1,13 @@
1
- import { n as __require } from "./rolldown-runtime-B_-DWIq7.js";
2
- import { a as AgentSignals, c as classifyAuthFailure, o as REMARK_INSTRUCTION, s as RESUME_INSTRUCTION } from "./errors-CQ9kttJD.js";
3
- import { a as getLogFilePath, o as initLogFile, r as debug, s as logToFile, v as runtimeEnv } from "./debug-Ch4BDOtD.js";
4
- import { Y as WIZARD_REMARK_EVENT_NAME, c as CONTEXT_MILL_URL, et as wizardUserAgentForProgram, o as AWS_SKILLS_BASE_URL } from "./constants-jFI2SaE1.js";
5
- import { n as analytics } from "./analytics-CHCZ_qUR.js";
6
- import { a as safeReadFile, i as readProjectFile, o as walkProjectFiles } from "./bounded-fs-Bx9zTe6m.js";
7
- import { t as registerCleanup } from "./wizard-abort-BBkiUxfS.js";
8
- import { i as gatewayApiFor, l as gatewayAuth, n as buildGatewayModel, s as buildWizardPropertiesBlob, u as isPastRefresh } from "./gateway-CjoShdLa.js";
9
- import { i as modelCapabilities, o as triageModelFor } from "./models-DDdBJKwT.js";
10
- import { _ as coerceAuditChecks, h as AUDIT_CHECKS_FILE, l as prewarmYaraScanner, n as createPostToolUseYaraHooks, p as scanInstalledSkill, r as createPreToolUseYaraHooks } from "./yara-hooks-DCeMDd1o.js";
11
- import { l as buildOrchestratorTools, v as makeMutex, y as writeJsonAtomic } from "./queue-tools-9OOVx5TE.js";
1
+ import { a as getLogFilePath, o as initLogFile, r as debug, s as logToFile, v as runtimeEnv } from "./debug-kAHwWGg7.js";
2
+ import { Y as WIZARD_REMARK_EVENT_NAME, c as CONTEXT_MILL_URL, et as wizardUserAgentForProgram, o as AWS_SKILLS_BASE_URL } from "./constants-DHCBSfnx.js";
3
+ import { n as analytics } from "./analytics-DXK1gc12.js";
4
+ import { i as classifyAuthFailure } from "./errors-C2domSkK.js";
5
+ import { a as safeReadFile, i as readProjectFile, o as walkProjectFiles } from "./bounded-fs-vAq-T-K7.js";
6
+ import { t as registerCleanup } from "./wizard-abort-BPdv07np.js";
7
+ import { c as REMARK_INSTRUCTION, f as gatewayAuth, i as gatewayApiFor, l as RESUME_INSTRUCTION, n as buildGatewayModel, p as isPastRefresh, s as AgentSignals, u as buildWizardPropertiesBlob } from "./gateway-C9-GlLO9.js";
8
+ import { i as modelCapabilities, o as triageModelFor } from "./models-WcwUnSKb.js";
9
+ import { _ as coerceAuditChecks, h as AUDIT_CHECKS_FILE, l as prewarmYaraScanner, n as createPostToolUseYaraHooks, p as scanInstalledSkill, r as createPreToolUseYaraHooks } from "./yara-hooks-BnxejtXK.js";
10
+ import { l as buildOrchestratorTools, v as makeMutex, y as writeJsonAtomic } from "./queue-tools-C8mXOh7e.js";
12
11
  import { createRequire } from "node:module";
13
12
  import * as fs$1 from "fs";
14
13
  import fs from "fs";
@@ -18,9 +17,12 @@ import { spawnSync } from "node:child_process";
18
17
  import { closeSync, constants, fchmodSync, lstatSync, openSync, renameSync, unlinkSync, writeSync } from "node:fs";
19
18
  import { randomBytes, randomUUID } from "node:crypto";
20
19
  import { z } from "zod";
20
+ import { randomUUID as randomUUID$1 } from "crypto";
21
21
  import * as os from "os";
22
22
  import { unzipSync } from "fflate";
23
- import { randomUUID as randomUUID$1 } from "crypto";
23
+ //#region \0rolldown/runtime.js
24
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
25
+ //#endregion
24
26
  //#region src/agent/triage-provider.ts
25
27
  const TRIAGE_MAX_TOKENS = 16384;
26
28
  const TRIAGE_TIMEOUT_MS = 2e4;
@@ -1629,8 +1631,18 @@ const WIZARD_TOOL_NAMES = {
1629
1631
  //#region src/agent/tools/handoff.ts
1630
1632
  const MAX_HANDOFF_TEXT_CHARS = 64 * 1024;
1631
1633
  const PUBLISH_HANDOFF_TOOL_NAME = "publish_handoff";
1632
- /** Shared between the MCP server and the pi facade so the contract can't drift. */
1633
- const PUBLISH_HANDOFF_DESCRIPTION = "Publish the handoff document — the full markdown report of what this run did — to the wizard session. Call it exactly once, at the end of the run, passing the complete report as `content`. This call is the required way to deliver the report to the user; do not write the report to a file yourself.";
1634
+ /**
1635
+ * Shared between the MCP server and the pi facade so the contract can't drift.
1636
+ *
1637
+ * Naming who publishes is the load-bearing part: every task of an orchestrated
1638
+ * run holds this tool, and "call it at the end of the run to deliver the
1639
+ * report" is an instruction all of them can follow — so a run published one
1640
+ * full report per step, each replaced by the next, and a step that read the
1641
+ * call as its own finish skipped `complete_task` and was restarted.
1642
+ */
1643
+ const PUBLISH_HANDOFF_DESCRIPTION = "Publish the handoff document — the full markdown report of what the whole run did — to the wizard session. A run publishes once: call it only when your own instructions ask you to write that report, passing the complete report as `content`, and never write the report to a file yourself. It is not how you report your own work — in a run made of several tasks each step finishes with complete_task, and a step that was not asked for the run report leaves this one uncalled, because the section it owns travels in its handoff.";
1644
+ /** Appended for a task agent: the reminder lands as it decides it has finished. */
1645
+ const TASK_REPORTING_NOTE = " This does not report your task: call complete_task to finish.";
1634
1646
  const PUBLISH_HANDOFF_CONTENT_DESCRIPTION = "The complete handoff report as markdown, starting with an H1 heading.";
1635
1647
  /**
1636
1648
  * Write the handoff report to the host-designated `targetPath`.
@@ -1692,7 +1704,7 @@ function writeHandoffFileAtomically(targetPath, text) {
1692
1704
  };
1693
1705
  }
1694
1706
  }
1695
- function publishHandoff(content, emit) {
1707
+ function publishHandoff(content, emit, opts = {}) {
1696
1708
  if (content.trim() === "") {
1697
1709
  analytics.wizardCapture("handoff published", {
1698
1710
  handoff_ok: false,
@@ -1731,7 +1743,7 @@ function publishHandoff(content, emit) {
1731
1743
  if (handoffOutputError) notes.push(`host output write failed: ${handoffOutputError}`);
1732
1744
  return {
1733
1745
  ok: true,
1734
- message: `Handoff published (${text.length} chars${notes.length > 0 ? `, ${notes.join("; ")}` : ""}).`
1746
+ message: `Handoff published (${text.length} chars${notes.length > 0 ? `, ${notes.join("; ")}` : ""}).${opts.taskAgent ? TASK_REPORTING_NOTE : ""}`
1735
1747
  };
1736
1748
  }
1737
1749
  //#endregion
@@ -2104,7 +2116,7 @@ async function createWizardToolsServer(options) {
2104
2116
  }
2105
2117
  }),
2106
2118
  tool(PUBLISH_HANDOFF_TOOL_NAME, PUBLISH_HANDOFF_DESCRIPTION, { content: z.string().describe(PUBLISH_HANDOFF_CONTENT_DESCRIPTION) }, (args) => {
2107
- const result = publishHandoff(args.content, emit);
2119
+ const result = publishHandoff(args.content, emit, { taskAgent: orchestrator?.currentTaskId !== void 0 });
2108
2120
  logToFile(`publish_handoff: ${result.message}`);
2109
2121
  return {
2110
2122
  content: [{
@@ -2405,7 +2417,7 @@ var AgentOutputSignals = class {
2405
2417
  }
2406
2418
  };
2407
2419
  //#endregion
2408
- //#region src/agent/agent-env-isolation.ts
2420
+ //#region src/shared/agent-env-isolation.ts
2409
2421
  /**
2410
2422
  * Credential isolation for the Claude Agent SDK subprocess.
2411
2423
  *
@@ -2997,6 +3009,10 @@ function buildAgentEnv(wizardMetadata, wizardFlags, teamId) {
2997
3009
  * this guard is a belt-and-suspenders second line.
2998
3010
  */
2999
3011
  function wizardCanUseTool(toolName, input, context = {}) {
3012
+ if (context.readOnly && !READ_ONLY_TOOLS.includes(toolName)) return {
3013
+ behavior: "deny",
3014
+ message: `Tool ${toolName} is disabled for read-only runs.`
3015
+ };
3000
3016
  if (context.disallowedTools?.includes(toolName)) {
3001
3017
  logToFile(`Denying disallowed tool: ${toolName}`);
3002
3018
  return {
@@ -3137,10 +3153,12 @@ async function initializeAgent(config, options) {
3137
3153
  workingDirectory: config.workingDirectory,
3138
3154
  mcpServers,
3139
3155
  model,
3156
+ outputFormat: config.outputFormat,
3140
3157
  posthogApiKey: config.posthogApiKey,
3141
3158
  currentPosthogApiKey: config.currentPosthogApiKey,
3142
3159
  wizardFlags: config.wizardFlags,
3143
3160
  wizardMetadata: config.wizardMetadata,
3161
+ readOnly: config.readOnly,
3144
3162
  allowedTools: config.allowedTools,
3145
3163
  disallowedTools: config.disallowedTools,
3146
3164
  getPendingQuestion: config.getPendingQuestion,
@@ -3199,9 +3217,15 @@ function sdkResultFailure(message) {
3199
3217
  if (message.subtype === "success" && message.is_error !== true) return void 0;
3200
3218
  const errors = Array.isArray(message.errors) ? message.errors : [];
3201
3219
  const detail = errors.map((error) => typeof error === "string" ? error : JSON.stringify(error)).join("; ") || (typeof message.result === "string" ? message.result : String(message.subtype ?? "SDK result failed"));
3220
+ const status = sdkErrorStatus(message.api_error_status) ?? sdkErrorStatus(message.status) ?? errors.map(sdkErrorStatus).find((code) => code !== void 0) ?? sdkErrorStatus(message.result);
3221
+ if (message.subtype === "error_max_structured_output_retries") return {
3222
+ kind: "failure",
3223
+ classification: "WIZARD_INVALID_STRUCTURED_OUTPUT",
3224
+ message: detail
3225
+ };
3202
3226
  return {
3203
3227
  kind: "failure",
3204
- classification: (sdkErrorStatus(message.api_error_status) ?? sdkErrorStatus(message.status) ?? errors.map(sdkErrorStatus).find((code) => code !== void 0) ?? sdkErrorStatus(message.result)) === 429 ? "WIZARD_RATE_LIMIT" : "WIZARD_API_ERROR",
3228
+ classification: status === 429 ? "WIZARD_RATE_LIMIT" : "WIZARD_API_ERROR",
3205
3229
  message: detail
3206
3230
  };
3207
3231
  }
@@ -3281,7 +3305,10 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
3281
3305
  logToFile(`${AgentSignals.BENCHMARK} Middleware finalize error:`, e);
3282
3306
  }
3283
3307
  spinner.stop(successMessage);
3284
- return { kind: "success" };
3308
+ return {
3309
+ kind: "success",
3310
+ structuredOutput: lastResultMessage?.structured_output
3311
+ };
3285
3312
  };
3286
3313
  let abortController = new AbortController();
3287
3314
  const onExternalAbort = () => {
@@ -3307,7 +3334,7 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
3307
3334
  }, timeoutMs) : void 0;
3308
3335
  try {
3309
3336
  const disallow = new Set(agentConfig.disallowedTools ?? []);
3310
- const allowedTools = [...BASE_ALLOWED_TOOLS, ...agentConfig.allowedTools ?? []].filter((t) => !disallow.has(t));
3337
+ const allowedTools = (agentConfig.readOnly ? READ_ONLY_TOOLS : [...BASE_ALLOWED_TOOLS, ...agentConfig.allowedTools ?? []]).filter((t) => !disallow.has(t));
3311
3338
  const inheritedMcpServerNames = Object.keys(agentConfig.mcpServers);
3312
3339
  const triageProvider = agentConfig.triageProvider;
3313
3340
  const onYaraTerminate = (reason) => {
@@ -3330,18 +3357,19 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
3330
3357
  abortController,
3331
3358
  resume,
3332
3359
  model: agentConfig.model,
3360
+ outputFormat: agentConfig.outputFormat,
3333
3361
  cwd: agentConfig.workingDirectory,
3334
- permissionMode: "acceptEdits",
3362
+ permissionMode: agentConfig.readOnly ? "default" : "acceptEdits",
3335
3363
  betas: ["context-1m-2025-08-07"],
3336
- mcpServers: agentConfig.mcpServers,
3337
- agents: { "general-purpose": {
3364
+ mcpServers: agentConfig.readOnly ? {} : agentConfig.mcpServers,
3365
+ agents: agentConfig.readOnly ? void 0 : { "general-purpose": {
3338
3366
  description: "General-purpose subagent. Inherits the parent run's tools plus the PostHog and wizard-tools MCP servers, so it can call mcp__posthog-wizard__* directly instead of curling the REST API.",
3339
3367
  prompt: "You are a general-purpose subagent for the PostHog wizard. Prefer the authenticated mcp__posthog-wizard__* MCP tools over raw HTTP — they are already authenticated for this project. Only fall back to other transports if no MCP tool covers the operation.",
3340
3368
  mcpServers: inheritedMcpServerNames,
3341
3369
  disallowedTools: agentConfig.disallowedTools ? [...agentConfig.disallowedTools] : void 0
3342
3370
  } },
3343
- settingSources: ["project"],
3344
- skills: "all",
3371
+ settingSources: agentConfig.readOnly ? [] : ["project"],
3372
+ skills: agentConfig.readOnly ? [] : "all",
3345
3373
  allowedTools,
3346
3374
  sandbox: {
3347
3375
  enabled: true,
@@ -3398,6 +3426,7 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
3398
3426
  input
3399
3427
  });
3400
3428
  const result = wizardCanUseTool(toolName, input, {
3429
+ readOnly: agentConfig.readOnly,
3401
3430
  wizardAskPending: agentConfig.getPendingQuestion?.() != null,
3402
3431
  disallowedTools: agentConfig.disallowedTools
3403
3432
  });
@@ -3413,7 +3442,7 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
3413
3442
  harness: "anthropic"
3414
3443
  })
3415
3444
  },
3416
- tools: {
3445
+ tools: agentConfig.readOnly ? [...READ_ONLY_TOOLS] : {
3417
3446
  type: "preset",
3418
3447
  preset: "claude_code"
3419
3448
  },
@@ -3688,6 +3717,10 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
3688
3717
  message: `Agent run timed out after ${timeoutMs / 1e3}s`
3689
3718
  };
3690
3719
  }
3720
+ if (terminalFailure) {
3721
+ spinner.stop(errorMessage);
3722
+ return terminalFailure;
3723
+ }
3691
3724
  const apiErrorMessage = signals.apiErrorMessage() ?? "Unknown API error";
3692
3725
  if (signals.hasApiErrorStatus(429)) {
3693
3726
  logToFile("Agent error (caught): RATE_LIMIT");
@@ -3764,6 +3797,11 @@ let TaskTool = /* @__PURE__ */ function(TaskTool) {
3764
3797
  * init handler has to recognise this server in the SDK's status report.
3765
3798
  */
3766
3799
  const POSTHOG_MCP_SERVER_NAME = "posthog-wizard";
3800
+ const READ_ONLY_TOOLS = [
3801
+ "Read",
3802
+ "Glob",
3803
+ "Grep"
3804
+ ];
3767
3805
  const BASE_ALLOWED_TOOLS = [
3768
3806
  "Read",
3769
3807
  "Write",
@@ -4051,4 +4089,4 @@ function handleSDKMessage(message, options, spinner, signals, emit, receivedSucc
4051
4089
  //#endregion
4052
4090
  export { vaultSensitiveAnswers as $, CHECK_ENV_KEYS_FILE_PATH_DESCRIPTION as A, describeAskCancellation as B, AUDIT_ADD_CHECKS_PARAM_DESCRIPTION as C, AUDIT_SEED_CHECKS_PARAM_DESCRIPTION as D, AUDIT_SEED_CHECKS_DESCRIPTION as E, WIZARD_ASK_TOOL_DESCRIPTION as F, mergeEnvValues as G, ensureGitignoreCoverage as H, WIZARD_TOOL_NAMES as I, resolveAuditChecks as J, normaliseAskSubject as K, addAuditChecks as L, WIZARD_ASK_KIND_DESCRIPTION as M, WIZARD_ASK_SENSITIVE_DESCRIPTION as N, AUDIT_STATUSES as O, WIZARD_ASK_SUBJECT_DESCRIPTION as P, templateEnvWriteRefusal as Q, checkEnvKeys as R, AUDIT_ADD_CHECKS_DESCRIPTION as S, AUDIT_RESOLVE_CHECKS_PARAM_DESCRIPTION as T, installSkillById as U, downloadSkill as V, legacyKeyNameRefusal as W, resolveEnvSecretRefs as X, resolveEnvPath as Y, seedAuditChecks as Z, createSecretVault as _, wizardCanUseTool as a, MAX_ENV_KEY_SET as at, PUBLISH_HANDOFF_TOOL_NAME as b, checkAllSettingsConflicts as c, toPromptSafeRelativePath as ct, restoreClaudeSettings as d, fetchSkillMenu as et, sanitizeAgentSubprocessEnv as f, assembleCommandments as g, markGrantRevoked as h, runAgent as i, isFullyCancelled as it, ENV_FILE_PATH_DESCRIPTION as j, CHECK_ENV_KEYS_DESCRIPTION as k, classifySettingsConflicts as l, createTriageLLMProvider as lt, isGrantRevoked as m, buildRunTags as n, LONGER_ASK_TIMEOUT_MS as nt, createIsolatedAgentConfigDir as o, isEnvFileName as ot, AgentOutputSignals as p, resolveAskQuestionKinds as q, initializeAgent as r, createWizardAskBridge as rt, backupAndFixClaudeSettings as s, parseEnvKeyNames as st, buildAgentEnv as t, fetchWithRetry as tt, recoverOrphanedSettingsBackups as u, PUBLISH_HANDOFF_CONTENT_DESCRIPTION as v, AUDIT_RESOLVE_CHECKS_DESCRIPTION as w, publishHandoff as x, PUBLISH_HANDOFF_DESCRIPTION as y, createAskAccounting as z };
4053
4091
 
4054
- //# sourceMappingURL=agent-interface-BAOIHuXS.js.map
4092
+ //# sourceMappingURL=agent-interface-FkbaBJwz.js.map