@posthog/wizard 2.79.0 → 2.80.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 (186) hide show
  1. package/dist/PickerMenu-m4CCPX4f.js +758 -0
  2. package/dist/PickerMenu-m4CCPX4f.js.map +1 -0
  3. package/dist/{agent-CNrEC-9v.js → agent-BkBbVuNq.js} +50 -45
  4. package/dist/agent-BkBbVuNq.js.map +1 -0
  5. package/dist/agent-QGK2YzlX.js +6 -0
  6. package/dist/{agent-interface-BXvmAm4c.js → agent-interface-CzyCmp7q.js} +87 -38
  7. package/dist/agent-interface-CzyCmp7q.js.map +1 -0
  8. package/dist/{agent-prompt-loader-DiKUbhi_.js → agent-prompt-loader-4wMxlYSX.js} +5 -5
  9. package/dist/{agent-prompt-loader-DiKUbhi_.js.map → agent-prompt-loader-4wMxlYSX.js.map} +1 -1
  10. package/dist/{analytics-VRYdebXW.js → analytics-B6q5PN7a.js} +5 -5
  11. package/dist/analytics-B6q5PN7a.js.map +1 -0
  12. package/dist/analytics-BXtfK9o7.js +2 -0
  13. package/dist/{api-DGuJTzjr.js → api-C3Dc4LFl.js} +4 -16
  14. package/dist/{api-DGuJTzjr.js.map → api-C3Dc4LFl.js.map} +1 -1
  15. package/dist/api-yNjrfZs2.js +2 -0
  16. package/dist/bin.js +5 -2960
  17. package/dist/bin.js.map +1 -1
  18. package/dist/{bounded-fs-Cpn129A4.js → bounded-fs-CC_NDtoP.js} +3 -3
  19. package/dist/{bounded-fs-Cpn129A4.js.map → bounded-fs-CC_NDtoP.js.map} +1 -1
  20. package/dist/check-screens.tsx +5 -5
  21. package/dist/{ci-install-BPA6gzEq.js → ci-install-DfcAMhlu.js} +9 -8
  22. package/dist/ci-install-DfcAMhlu.js.map +1 -0
  23. package/dist/{constants-CuJfQEcC.js → constants-DO4X70po.js} +3 -3
  24. package/dist/{constants-CuJfQEcC.js.map → constants-DO4X70po.js.map} +1 -1
  25. package/dist/{debug-B9k4ideV.js → debug-BueK5mRR.js} +1 -1
  26. package/dist/{debug-Cj-8vfXY.js → debug-DyARf5TF.js} +3 -3
  27. package/dist/debug-DyARf5TF.js.map +1 -0
  28. package/dist/{defaults-C6J7yL4O.js → defaults-DpfMnH2q.js} +2 -2
  29. package/dist/defaults-DpfMnH2q.js.map +1 -0
  30. package/dist/emit-BSetXzDV.js +69 -0
  31. package/dist/emit-BSetXzDV.js.map +1 -0
  32. package/dist/{endpoints-DnIX0pZH.js → endpoints-D-4KxZiB.js} +3 -3
  33. package/dist/{endpoints-DnIX0pZH.js.map → endpoints-D-4KxZiB.js.map} +1 -1
  34. package/dist/env-api-key-CHGLe0iz.js +2 -0
  35. package/dist/{env-api-key-BWdKpGEr.js → env-api-key-COf0U-Au.js} +3 -5
  36. package/dist/{env-api-key-BWdKpGEr.js.map → env-api-key-COf0U-Au.js.map} +1 -1
  37. package/dist/{environment-DZYUSCpV.js → environment-DrLaSsA8.js} +5 -10
  38. package/dist/{environment-DZYUSCpV.js.map → environment-DrLaSsA8.js.map} +1 -1
  39. package/dist/environment-hBj7ngmO.js +2 -0
  40. package/dist/{errors-ddDE6MbA.js → errors-C2domSkK.js} +3 -67
  41. package/dist/errors-C2domSkK.js.map +1 -0
  42. package/dist/{file-dEhr-l3n.js → file-CVA9ocIC.js} +4 -4
  43. package/dist/file-CVA9ocIC.js.map +1 -0
  44. package/dist/file-CmoKK_Pp.js +2 -0
  45. package/dist/{file-watcher-CPM-Nn9L.js → file-watcher-C3Su8vXm.js} +3 -3
  46. package/dist/file-watcher-C3Su8vXm.js.map +1 -0
  47. package/dist/{gateway-CVU1G0H3.js → gateway-BmjYUSua.js} +8 -7
  48. package/dist/{gateway-CVU1G0H3.js.map → gateway-BmjYUSua.js.map} +1 -1
  49. package/dist/{headless-ui-pY2xB5ug.js → headless-ui-CUbv12Yx.js} +3 -3
  50. package/dist/headless-ui-CUbv12Yx.js.map +1 -0
  51. package/dist/host-resolution-DVSb7kXb.js +114 -0
  52. package/dist/host-resolution-DVSb7kXb.js.map +1 -0
  53. package/dist/{add-mcp-server-to-clients-amlJWW7W.js → install-Bk5TNk27.js} +16 -26
  54. package/dist/install-Bk5TNk27.js.map +1 -0
  55. package/dist/install-F4wm3RSl.js +2 -0
  56. package/dist/interactive-C5LNvDj6.js +11 -0
  57. package/dist/interactive-C5LNvDj6.js.map +1 -0
  58. package/dist/{telemetry-Bpv-Mh5B.js → links-9LWZPSCq.js} +4 -13
  59. package/dist/links-9LWZPSCq.js.map +1 -0
  60. package/dist/{logging-ui-CUxNYF2t.js → logging-ui-p6XKVmTx.js} +6 -6
  61. package/dist/logging-ui-p6XKVmTx.js.map +1 -0
  62. package/dist/main-DKPjFHEV.js +1404 -0
  63. package/dist/main-DKPjFHEV.js.map +1 -0
  64. package/dist/{mcp-JcsBBnWv.js → mcp-Co8VRF62.js} +4 -4
  65. package/dist/{mcp-JcsBBnWv.js.map → mcp-Co8VRF62.js.map} +1 -1
  66. package/dist/mcp-install-smoke-test.ts +1 -1
  67. package/dist/{mcp-prompt-streaming-B-p_Pvb2.js → mcp-prompt-streaming-ljCVoQ9I.js} +6 -6
  68. package/dist/{mcp-prompt-streaming-B-p_Pvb2.js.map → mcp-prompt-streaming-ljCVoQ9I.js.map} +1 -1
  69. package/dist/{mint-failure-CZFZpHpW.js → mint-failure-C0HyvEwO.js} +105 -93
  70. package/dist/mint-failure-C0HyvEwO.js.map +1 -0
  71. package/dist/{models-DnAY67Lg.js → models-Dba8ITeo.js} +2 -2
  72. package/dist/{models-DnAY67Lg.js.map → models-Dba8ITeo.js.map} +1 -1
  73. package/dist/{non-interactive-DR1CWXY1.js → non-interactive-CLMJrj_7.js} +5 -4
  74. package/dist/non-interactive-CLMJrj_7.js.map +1 -0
  75. package/dist/{oauth-session-CQTFOk-I.js → oauth-session-D-RfcVmr.js} +2 -2
  76. package/dist/{oauth-session-CQTFOk-I.js.map → oauth-session-D-RfcVmr.js.map} +1 -1
  77. package/dist/{orchestrator-tools-CBdt-SXO.js → orchestrator-tools-CVJ1F9Ub.js} +3 -3
  78. package/dist/{orchestrator-tools-CBdt-SXO.js.map → orchestrator-tools-CVJ1F9Ub.js.map} +1 -1
  79. package/dist/package-json--ppioh2F.js +2 -0
  80. package/dist/{package-json-DY70kkNp.js → package-json-Cowya9-3.js} +2 -8
  81. package/dist/{package-json-DY70kkNp.js.map → package-json-Cowya9-3.js.map} +1 -1
  82. package/dist/{pi-BtqcLX3y.js → pi-B5YTBRDv.js} +20 -18
  83. package/dist/pi-B5YTBRDv.js.map +1 -0
  84. package/dist/{playground-Dz-ZVjBk.js → playground-BLsCfHmQ.js} +33 -33
  85. package/dist/playground-BLsCfHmQ.js.map +1 -0
  86. package/dist/posthog-B2E0hpZt.js +2 -0
  87. package/dist/{posthog-6Uqw_Eux.js → posthog-B42rt_1S.js} +4 -9
  88. package/dist/posthog-B42rt_1S.js.map +1 -0
  89. package/dist/project-data--L-WZyvj.js +2 -0
  90. package/dist/{setup-utils-dCViCC6s.js → project-data-BO9IXn9y.js} +566 -957
  91. package/dist/project-data-BO9IXn9y.js.map +1 -0
  92. package/dist/provisioning-C01REIU2.js +2 -0
  93. package/dist/{provisioning-Zf7yPcEs.js → provisioning-CLhuKqXH.js} +6 -73
  94. package/dist/provisioning-CLhuKqXH.js.map +1 -0
  95. package/dist/{queue-tools-B7_aCyd-.js → queue-tools-knnPQP0e.js} +4 -4
  96. package/dist/{queue-tools-B7_aCyd-.js.map → queue-tools-knnPQP0e.js.map} +1 -1
  97. package/dist/{registry-B6iLGorH.js → registry-B3rC5U4b.js} +7 -9
  98. package/dist/{registry-B6iLGorH.js.map → registry-B3rC5U4b.js.map} +1 -1
  99. package/dist/registry-BamsM7J9.js +2 -0
  100. package/dist/run-agent-legacy-CwUmPfQF.js +2 -0
  101. package/dist/{run-agent-legacy-6WcYMaR9.js → run-agent-legacy-DWBajsMh.js} +40 -114
  102. package/dist/run-agent-legacy-DWBajsMh.js.map +1 -0
  103. package/dist/runners-D1PqqpjA.js +834 -0
  104. package/dist/runners-D1PqqpjA.js.map +1 -0
  105. package/dist/{security-lkBwWbrK.js → security-BvdSFDuM.js} +5 -5
  106. package/dist/{security-lkBwWbrK.js.map → security-BvdSFDuM.js.map} +1 -1
  107. package/dist/setup-utils-ChXXTi1m.js +301 -0
  108. package/dist/setup-utils-ChXXTi1m.js.map +1 -0
  109. package/dist/{start-tui-oCWMgsDP.js → start-tui-DicLfgsj.js} +95 -91
  110. package/dist/start-tui-DicLfgsj.js.map +1 -0
  111. package/dist/{steps-gx0Pq4I4.js → steps-Hc28zVc_.js} +10 -10
  112. package/dist/steps-Hc28zVc_.js.map +1 -0
  113. package/dist/store-COCO6U0P.js +5 -0
  114. package/dist/{store-xYy_6Ruv.js → store-D3509G87.js} +67 -35
  115. package/dist/store-D3509G87.js.map +1 -0
  116. package/dist/{subagent-Bfy0sfhU.js → subagent-D_Sqak94.js} +3 -3
  117. package/dist/{subagent-Bfy0sfhU.js.map → subagent-D_Sqak94.js.map} +1 -1
  118. package/dist/{task-BOfw7GPc.js → task-DiTI6Sak.js} +19 -17
  119. package/dist/task-DiTI6Sak.js.map +1 -0
  120. package/dist/{wizard-ui-DoyOZxK8.js → task-status-CmrrR7zo.js} +2 -2
  121. package/dist/task-status-CmrrR7zo.js.map +1 -0
  122. package/dist/{task-stream-kYlm9qd0.js → task-stream-BckhG_cB.js} +11 -11
  123. package/dist/task-stream-BckhG_cB.js.map +1 -0
  124. package/dist/{tasks-Bbv_lOBG.js → tasks-ChZ_F1YP.js} +1 -1
  125. package/dist/{tasks-Bbv_lOBG.js.map → tasks-ChZ_F1YP.js.map} +1 -1
  126. package/dist/telemetry-BNKsDxNS.js +13 -0
  127. package/dist/telemetry-BNKsDxNS.js.map +1 -0
  128. package/dist/{terminal-D07EQ2y0.js → terminal-PK9bCLRi.js} +123 -97
  129. package/dist/terminal-PK9bCLRi.js.map +1 -0
  130. package/dist/{tools-Cc41af5W.js → tools-C8LQ8QFz.js} +9 -9
  131. package/dist/tools-C8LQ8QFz.js.map +1 -0
  132. package/dist/{ui-CGXtC7Vn.js → ui-tPNpM6vj.js} +3 -3
  133. package/dist/ui-tPNpM6vj.js.map +1 -0
  134. package/dist/urls-BI4kJ4qQ.js +67 -0
  135. package/dist/urls-BI4kJ4qQ.js.map +1 -0
  136. package/dist/{version-Cadof0Z_.js → version-5_ydHkM6.js} +2 -2
  137. package/dist/{version-Cadof0Z_.js.map → version-5_ydHkM6.js.map} +1 -1
  138. package/dist/wizard-abort-BVjqLyeA.js +3 -0
  139. package/dist/{wizard-abort-HDbP3YcS.js → wizard-abort-DBKtfnBR.js} +20 -17
  140. package/dist/wizard-abort-DBKtfnBR.js.map +1 -0
  141. package/dist/wizard-session-B7BHnay0.js +2 -0
  142. package/dist/{wizard-session-2w4Ru-Wz.js → wizard-session-BYw6LzpS.js} +30 -28
  143. package/dist/wizard-session-BYw6LzpS.js.map +1 -0
  144. package/dist/{yara-hooks-DCfROpZt.js → yara-hooks-C3L6lBij.js} +5 -5
  145. package/dist/{yara-hooks-DCfROpZt.js.map → yara-hooks-C3L6lBij.js.map} +1 -1
  146. package/dist/yara-hooks-CF_IsoaA.js +2 -0
  147. package/package.json +2 -3
  148. package/dist/add-mcp-server-to-clients-amlJWW7W.js.map +0 -1
  149. package/dist/agent-CNrEC-9v.js.map +0 -1
  150. package/dist/agent-interface-BXvmAm4c.js.map +0 -1
  151. package/dist/analytics-DxwRi2Hf.js +0 -2
  152. package/dist/analytics-VRYdebXW.js.map +0 -1
  153. package/dist/ci-install-BPA6gzEq.js.map +0 -1
  154. package/dist/debug-Cj-8vfXY.js.map +0 -1
  155. package/dist/defaults-C6J7yL4O.js.map +0 -1
  156. package/dist/errors-ddDE6MbA.js.map +0 -1
  157. package/dist/file-dEhr-l3n.js.map +0 -1
  158. package/dist/file-watcher-CPM-Nn9L.js.map +0 -1
  159. package/dist/headless-ui-pY2xB5ug.js.map +0 -1
  160. package/dist/interactive-BOGlinZe.js +0 -11
  161. package/dist/interactive-BOGlinZe.js.map +0 -1
  162. package/dist/logging-ui-CUxNYF2t.js.map +0 -1
  163. package/dist/mint-failure-CZFZpHpW.js.map +0 -1
  164. package/dist/non-interactive-DR1CWXY1.js.map +0 -1
  165. package/dist/pi-BtqcLX3y.js.map +0 -1
  166. package/dist/playground-Dz-ZVjBk.js.map +0 -1
  167. package/dist/posthog-6Uqw_Eux.js.map +0 -1
  168. package/dist/provisioning-Zf7yPcEs.js.map +0 -1
  169. package/dist/rolldown-runtime-B_-DWIq7.js +0 -15
  170. package/dist/run-agent-legacy-6WcYMaR9.js.map +0 -1
  171. package/dist/setup-utils-dCViCC6s.js.map +0 -1
  172. package/dist/start-tui-oCWMgsDP.js.map +0 -1
  173. package/dist/steps-gx0Pq4I4.js.map +0 -1
  174. package/dist/store-xYy_6Ruv.js.map +0 -1
  175. package/dist/task-BOfw7GPc.js.map +0 -1
  176. package/dist/task-stream-kYlm9qd0.js.map +0 -1
  177. package/dist/telemetry-Bpv-Mh5B.js.map +0 -1
  178. package/dist/terminal-D07EQ2y0.js.map +0 -1
  179. package/dist/tools-Cc41af5W.js.map +0 -1
  180. package/dist/ui-CGXtC7Vn.js.map +0 -1
  181. package/dist/wizard-abort-HDbP3YcS.js.map +0 -1
  182. package/dist/wizard-abort-Y-Ip2K4z.js +0 -3
  183. package/dist/wizard-session-2w4Ru-Wz.js.map +0 -1
  184. package/dist/wizard-session-DGaUHOF3.js +0 -2
  185. package/dist/wizard-ui-DoyOZxK8.js.map +0 -1
  186. package/dist/yara-hooks-B49RIk5d.js +0 -2
@@ -0,0 +1,6 @@
1
+ import "./agent-interface-CzyCmp7q.js";
2
+ import { d as configureGatewayFromCIEnvironment } from "./gateway-BmjYUSua.js";
3
+ import { t as runMcpPromptViaSdk } from "./agent-BkBbVuNq.js";
4
+ import "./yara-hooks-C3L6lBij.js";
5
+ import "./queue-tools-knnPQP0e.js";
6
+ export { configureGatewayFromCIEnvironment, runMcpPromptViaSdk };
@@ -1,14 +1,13 @@
1
- import { n as __require } from "./rolldown-runtime-B_-DWIq7.js";
2
- import { i as classifyAuthFailure } from "./errors-ddDE6MbA.js";
3
- import { a as getLogFilePath, o as initLogFile, r as debug, s as logToFile, v as runtimeEnv } from "./debug-Cj-8vfXY.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-CuJfQEcC.js";
5
- import { n as analytics } from "./analytics-VRYdebXW.js";
6
- import { a as safeReadFile, i as readProjectFile, o as walkProjectFiles } from "./bounded-fs-Cpn129A4.js";
7
- import { t as registerCleanup } from "./wizard-abort-HDbP3YcS.js";
8
- 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-CVU1G0H3.js";
9
- import { i as modelCapabilities, o as triageModelFor } from "./models-DnAY67Lg.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-DCfROpZt.js";
11
- import { l as buildOrchestratorTools, v as makeMutex, y as writeJsonAtomic } from "./queue-tools-B7_aCyd-.js";
1
+ import { a as getLogFilePath, o as initLogFile, r as debug, s as logToFile, v as runtimeEnv } from "./debug-DyARf5TF.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-DO4X70po.js";
3
+ import { n as analytics } from "./analytics-B6q5PN7a.js";
4
+ import { i as classifyAuthFailure } from "./errors-C2domSkK.js";
5
+ import { a as safeReadFile, i as readProjectFile, o as walkProjectFiles } from "./bounded-fs-CC_NDtoP.js";
6
+ import { t as registerCleanup } from "./wizard-abort-DBKtfnBR.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-BmjYUSua.js";
8
+ import { i as modelCapabilities, o as triageModelFor } from "./models-Dba8ITeo.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-C3L6lBij.js";
10
+ import { l as buildOrchestratorTools, v as makeMutex, y as writeJsonAtomic } from "./queue-tools-knnPQP0e.js";
12
11
  import { createRequire } from "node:module";
13
12
  import * as fs$1 from "fs";
14
13
  import fs from "fs";
@@ -16,11 +15,14 @@ import path from "path";
16
15
  import path$1 from "node:path";
17
16
  import { spawnSync } from "node:child_process";
18
17
  import { closeSync, constants, fchmodSync, lstatSync, openSync, renameSync, unlinkSync, writeSync } from "node:fs";
19
- import { randomBytes, randomUUID } from "node:crypto";
20
- import { z } from "zod";
21
- import { randomUUID as randomUUID$1 } from "crypto";
18
+ import { randomUUID } from "crypto";
19
+ import { randomBytes, randomUUID as randomUUID$1 } from "node:crypto";
22
20
  import * as os from "os";
23
21
  import { unzipSync } from "fflate";
22
+ import { z } from "zod";
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;
@@ -71,6 +73,34 @@ function createTriageLLMProvider(auth, harness) {
71
73
  }
72
74
  };
73
75
  }
76
+ //#endregion
77
+ //#region src/shared/ask-policy.ts
78
+ /**
79
+ * Decide whether the `wizard_ask` overlay should be wired for this run.
80
+ * Disabled in non-interactive modes (CI, signup) — there's no human to
81
+ * answer. Per-program disabling is done by adding WIZARD_ASK_TOOL_NAME to
82
+ * the program's `disallowedTools` so the SDK rejects calls outright.
83
+ * Extracted so the policy can be unit-tested directly.
84
+ *
85
+ * `e2eAsk` is the one escape hatch. The e2e harness runs a `ci`
86
+ * session, but it does have an answerer — the driver loop answers each
87
+ * `wizard_ask` batch from the program's e2e profile. Without the flag the
88
+ * agent-in-the-loop layer (the ask bridge in both sequence arms, and the
89
+ * orchestrator's seeded warehouse task) stays unreachable from a test.
90
+ *
91
+ * Only the e2e TUI host sets the flag, from the `E2E_ASK` env var. No CLI flag
92
+ * populates it, so plain `--ci` and `--signup` runs behave exactly as before.
93
+ */
94
+ function shouldDisableAsk(flags) {
95
+ return (flags.ci || flags.signup) && !flags.e2eAsk;
96
+ }
97
+ /**
98
+ * The longer per-question timeout, for asks that send the user on an errand —
99
+ * open a database console, mint a restricted API key. The default above is
100
+ * sized for a question answerable from memory and expires long before an
101
+ * errand is done.
102
+ */
103
+ const LONGER_ASK_TIMEOUT_MS = 1200 * 1e3;
74
104
  /** A scan retains at most this many distinct key names. */
75
105
  const MAX_ENV_KEY_SET = 5e3;
76
106
  /** Files whose names start with `.env` carry env keys (`.env.local`, `.env.production`, …). */
@@ -727,13 +757,6 @@ function evaluateBashCommand(rawCommand) {
727
757
  */
728
758
  /** Sentinel returned for unanswered fields on cancellation or timeout. */
729
759
  const CANCELLED_SENTINEL = "__cancelled__";
730
- /**
731
- * The longer per-question timeout, for asks that send the user on an errand —
732
- * open a database console, mint a restricted API key. The default above is
733
- * sized for a question answerable from memory and expires long before an
734
- * errand is done.
735
- */
736
- const LONGER_ASK_TIMEOUT_MS = 1200 * 1e3;
737
760
  function buildCancelledAnswers(questions) {
738
761
  const out = {};
739
762
  for (const q of questions) out[q.id] = CANCELLED_SENTINEL;
@@ -758,7 +781,7 @@ function createWizardAskBridge(opts) {
758
781
  timedOut: false
759
782
  };
760
783
  const pending = {
761
- id: randomUUID$1(),
784
+ id: randomUUID(),
762
785
  questions,
763
786
  source: opts.getSource(),
764
787
  richLinks: opts.richLinks ?? false,
@@ -769,13 +792,21 @@ function createWizardAskBridge(opts) {
769
792
  const controller = new AbortController();
770
793
  let timer;
771
794
  let timedOut = false;
795
+ let settled = false;
796
+ let answeredCount = 0;
772
797
  let cancelForAbort;
798
+ let armTimeout = () => void 0;
773
799
  const timeoutPromise = new Promise((resolve) => {
774
- timer = setTimeout(() => {
775
- timedOut = true;
776
- resolve(buildCancelledAnswers(questions));
777
- controller.abort();
778
- }, timeoutMs);
800
+ armTimeout = () => {
801
+ if (settled) return;
802
+ if (timer) clearTimeout(timer);
803
+ timer = setTimeout(() => {
804
+ timedOut = true;
805
+ resolve(buildCancelledAnswers(questions));
806
+ controller.abort();
807
+ }, timeoutMs);
808
+ };
809
+ armTimeout();
779
810
  });
780
811
  const aborted = new Promise((resolve) => {
781
812
  cancelForAbort = () => {
@@ -786,7 +817,13 @@ function createWizardAskBridge(opts) {
786
817
  });
787
818
  try {
788
819
  const answers = await Promise.race([
789
- opts.showQuestion(pending, { signal: controller.signal }),
820
+ opts.showQuestion(pending, {
821
+ signal: controller.signal,
822
+ onAnswer: () => {
823
+ answeredCount += 1;
824
+ armTimeout();
825
+ }
826
+ }),
790
827
  timeoutPromise,
791
828
  aborted
792
829
  ]);
@@ -795,6 +832,7 @@ function createWizardAskBridge(opts) {
795
832
  source: pending.source,
796
833
  subject,
797
834
  question_count: questions.length,
835
+ questions_answered: answeredCount,
798
836
  duration_ms: durationMs,
799
837
  timed_out: timedOut
800
838
  });
@@ -809,6 +847,7 @@ function createWizardAskBridge(opts) {
809
847
  timedOut
810
848
  };
811
849
  } finally {
850
+ settled = true;
812
851
  if (timer) clearTimeout(timer);
813
852
  if (cancelForAbort) opts.signal?.removeEventListener("abort", cancelForAbort);
814
853
  pendingQuestions.delete(pending.id);
@@ -1629,8 +1668,18 @@ const WIZARD_TOOL_NAMES = {
1629
1668
  //#region src/agent/tools/handoff.ts
1630
1669
  const MAX_HANDOFF_TEXT_CHARS = 64 * 1024;
1631
1670
  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.";
1671
+ /**
1672
+ * Shared between the MCP server and the pi facade so the contract can't drift.
1673
+ *
1674
+ * Naming who publishes is the load-bearing part: every task of an orchestrated
1675
+ * run holds this tool, and "call it at the end of the run to deliver the
1676
+ * report" is an instruction all of them can follow — so a run published one
1677
+ * full report per step, each replaced by the next, and a step that read the
1678
+ * call as its own finish skipped `complete_task` and was restarted.
1679
+ */
1680
+ 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.";
1681
+ /** Appended for a task agent: the reminder lands as it decides it has finished. */
1682
+ const TASK_REPORTING_NOTE = " This does not report your task: call complete_task to finish.";
1634
1683
  const PUBLISH_HANDOFF_CONTENT_DESCRIPTION = "The complete handoff report as markdown, starting with an H1 heading.";
1635
1684
  /**
1636
1685
  * Write the handoff report to the host-designated `targetPath`.
@@ -1692,7 +1741,7 @@ function writeHandoffFileAtomically(targetPath, text) {
1692
1741
  };
1693
1742
  }
1694
1743
  }
1695
- function publishHandoff(content, emit) {
1744
+ function publishHandoff(content, emit, opts = {}) {
1696
1745
  if (content.trim() === "") {
1697
1746
  analytics.wizardCapture("handoff published", {
1698
1747
  handoff_ok: false,
@@ -1731,7 +1780,7 @@ function publishHandoff(content, emit) {
1731
1780
  if (handoffOutputError) notes.push(`host output write failed: ${handoffOutputError}`);
1732
1781
  return {
1733
1782
  ok: true,
1734
- message: `Handoff published (${text.length} chars${notes.length > 0 ? `, ${notes.join("; ")}` : ""}).`
1783
+ message: `Handoff published (${text.length} chars${notes.length > 0 ? `, ${notes.join("; ")}` : ""}).${opts.taskAgent ? TASK_REPORTING_NOTE : ""}`
1735
1784
  };
1736
1785
  }
1737
1786
  //#endregion
@@ -1755,7 +1804,7 @@ function createSecretVault() {
1755
1804
  const store = /* @__PURE__ */ new Map();
1756
1805
  return {
1757
1806
  put(value, meta) {
1758
- const ref = `${REF_PREFIX}${randomUUID$1()}`;
1807
+ const ref = `${REF_PREFIX}${randomUUID()}`;
1759
1808
  store.set(ref, {
1760
1809
  value,
1761
1810
  meta: {
@@ -2104,7 +2153,7 @@ async function createWizardToolsServer(options) {
2104
2153
  }
2105
2154
  }),
2106
2155
  tool(PUBLISH_HANDOFF_TOOL_NAME, PUBLISH_HANDOFF_DESCRIPTION, { content: z.string().describe(PUBLISH_HANDOFF_CONTENT_DESCRIPTION) }, (args) => {
2107
- const result = publishHandoff(args.content, emit);
2156
+ const result = publishHandoff(args.content, emit, { taskAgent: orchestrator?.currentTaskId !== void 0 });
2108
2157
  logToFile(`publish_handoff: ${result.message}`);
2109
2158
  return {
2110
2159
  content: [{
@@ -3807,11 +3856,11 @@ function handleTaskCreate(block, store) {
3807
3856
  if (!input?.subject) return;
3808
3857
  let source = taskSources.get(store.tasks);
3809
3858
  if (!source) {
3810
- source = randomUUID();
3859
+ source = randomUUID$1();
3811
3860
  taskSources.set(store.tasks, source);
3812
3861
  }
3813
3862
  store.tasks.set(block.id, {
3814
- id: randomUUID(),
3863
+ id: randomUUID$1(),
3815
3864
  source,
3816
3865
  content: input.subject,
3817
3866
  status: "pending",
@@ -4075,6 +4124,6 @@ function handleSDKMessage(message, options, spinner, signals, emit, receivedSucc
4075
4124
  }
4076
4125
  }
4077
4126
  //#endregion
4078
- 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 };
4127
+ 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, isEnvFileName as at, PUBLISH_HANDOFF_TOOL_NAME as b, checkAllSettingsConflicts as c, LONGER_ASK_TIMEOUT_MS as ct, restoreClaudeSettings as d, fetchSkillMenu as et, sanitizeAgentSubprocessEnv as f, assembleCommandments as g, markGrantRevoked as h, runAgent as i, MAX_ENV_KEY_SET as it, ENV_FILE_PATH_DESCRIPTION as j, CHECK_ENV_KEYS_DESCRIPTION as k, classifySettingsConflicts as l, shouldDisableAsk as lt, isGrantRevoked as m, buildRunTags as n, createWizardAskBridge as nt, createIsolatedAgentConfigDir as o, parseEnvKeyNames as ot, AgentOutputSignals as p, resolveAskQuestionKinds as q, initializeAgent as r, isFullyCancelled as rt, backupAndFixClaudeSettings as s, toPromptSafeRelativePath as st, buildAgentEnv as t, fetchWithRetry as tt, recoverOrphanedSettingsBackups as u, createTriageLLMProvider as ut, PUBLISH_HANDOFF_CONTENT_DESCRIPTION as v, AUDIT_RESOLVE_CHECKS_DESCRIPTION as w, publishHandoff as x, PUBLISH_HANDOFF_DESCRIPTION as y, createAskAccounting as z };
4079
4128
 
4080
- //# sourceMappingURL=agent-interface-BXvmAm4c.js.map
4129
+ //# sourceMappingURL=agent-interface-CzyCmp7q.js.map