@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.
- package/README.md +20 -11
- package/dist/PickerMenu-dG5DQCZA.js +758 -0
- package/dist/PickerMenu-dG5DQCZA.js.map +1 -0
- package/dist/{add-mcp-server-to-clients-JMv8LP-O.js → add-mcp-server-to-clients-DIaTRWMY.js} +7 -18
- package/dist/{add-mcp-server-to-clients-JMv8LP-O.js.map → add-mcp-server-to-clients-DIaTRWMY.js.map} +1 -1
- package/dist/add-mcp-server-to-clients-artmN7mz.js +2 -0
- package/dist/agent-BEjARD2a.js +6 -0
- package/dist/{agent-bCZ3i3fh.js → agent-BWFhuLgo.js} +131 -38
- package/dist/agent-BWFhuLgo.js.map +1 -0
- package/dist/{agent-interface-BAOIHuXS.js → agent-interface-FkbaBJwz.js} +66 -28
- package/dist/agent-interface-FkbaBJwz.js.map +1 -0
- package/dist/{agent-prompt-loader-7Pd4CfZO.js → agent-prompt-loader-D0weQ-7k.js} +5 -5
- package/dist/{agent-prompt-loader-7Pd4CfZO.js.map → agent-prompt-loader-D0weQ-7k.js.map} +1 -1
- package/dist/analytics-DFtbRjYh.js +2 -0
- package/dist/{analytics-CHCZ_qUR.js → analytics-DXK1gc12.js} +4 -4
- package/dist/{analytics-CHCZ_qUR.js.map → analytics-DXK1gc12.js.map} +1 -1
- package/dist/api-Cm9UtKZh.js +2 -0
- package/dist/{api-Diy_2fp8.js → api-CrbCIQOz.js} +4 -16
- package/dist/{api-Diy_2fp8.js.map → api-CrbCIQOz.js.map} +1 -1
- package/dist/bin.js +5 -2957
- package/dist/bin.js.map +1 -1
- package/dist/{bounded-fs-Bx9zTe6m.js → bounded-fs-vAq-T-K7.js} +3 -3
- package/dist/{bounded-fs-Bx9zTe6m.js.map → bounded-fs-vAq-T-K7.js.map} +1 -1
- package/dist/{ci-install-CDdQYsPe.js → ci-install-COcV8SY2.js} +8 -7
- package/dist/ci-install-COcV8SY2.js.map +1 -0
- package/dist/{constants-jFI2SaE1.js → constants-DHCBSfnx.js} +3 -3
- package/dist/{constants-jFI2SaE1.js.map → constants-DHCBSfnx.js.map} +1 -1
- package/dist/{debug-M2gV2iDq.js → debug-BuYHGr6_.js} +1 -1
- package/dist/{debug-Ch4BDOtD.js → debug-kAHwWGg7.js} +2 -2
- package/dist/{debug-Ch4BDOtD.js.map → debug-kAHwWGg7.js.map} +1 -1
- package/dist/{defaults-C6J7yL4O.js → defaults-a9TelDhJ.js} +1 -1
- package/dist/{defaults-C6J7yL4O.js.map → defaults-a9TelDhJ.js.map} +1 -1
- package/dist/emit-BSetXzDV.js +69 -0
- package/dist/emit-BSetXzDV.js.map +1 -0
- package/dist/{endpoints-DCVbM06L.js → endpoints-BVMYm9F4.js} +3 -3
- package/dist/{endpoints-DCVbM06L.js.map → endpoints-BVMYm9F4.js.map} +1 -1
- package/dist/{env-api-key-Qx8NnYHm.js → env-api-key-BP-NFFXt.js} +3 -5
- package/dist/{env-api-key-Qx8NnYHm.js.map → env-api-key-BP-NFFXt.js.map} +1 -1
- package/dist/env-api-key-CaWEDj_9.js +2 -0
- package/dist/{environment-B07Bmxae.js → environment-BATlQxcQ.js} +5 -10
- package/dist/{environment-B07Bmxae.js.map → environment-BATlQxcQ.js.map} +1 -1
- package/dist/environment-CwD8OPYj.js +2 -0
- package/dist/errors-C2domSkK.js +79 -0
- package/dist/errors-C2domSkK.js.map +1 -0
- package/dist/file-C5JMsyR1.js +2 -0
- package/dist/{file-BcLTjU16.js → file-DcRKycV8.js} +4 -4
- package/dist/file-DcRKycV8.js.map +1 -0
- package/dist/{file-watcher-DWc_bTs6.js → file-watcher-Brq2nnHV.js} +2 -2
- package/dist/{file-watcher-DWc_bTs6.js.map → file-watcher-Brq2nnHV.js.map} +1 -1
- package/dist/{gateway-CjoShdLa.js → gateway-C9-GlLO9.js} +39 -8
- package/dist/gateway-C9-GlLO9.js.map +1 -0
- package/dist/{headless-ui-BFFmYC4v.js → headless-ui-CqI2gXlD.js} +2 -2
- package/dist/{headless-ui-BFFmYC4v.js.map → headless-ui-CqI2gXlD.js.map} +1 -1
- package/dist/{interactive-D6zV7brJ.js → interactive-B_Ti_CsS.js} +3 -3
- package/dist/interactive-B_Ti_CsS.js.map +1 -0
- package/dist/{logging-ui-_TwoMNbG.js → logging-ui-Dza4D0MK.js} +5 -5
- package/dist/{logging-ui-_TwoMNbG.js.map → logging-ui-Dza4D0MK.js.map} +1 -1
- package/dist/main-CgKxbwMP.js +1396 -0
- package/dist/main-CgKxbwMP.js.map +1 -0
- package/dist/{mcp-DAgaoGk5.js → mcp-DnAyW0-w.js} +4 -4
- package/dist/{mcp-DAgaoGk5.js.map → mcp-DnAyW0-w.js.map} +1 -1
- package/dist/{mcp-prompt-streaming-I2U_X7BC.js → mcp-prompt-streaming-DDWQ-FCA.js} +6 -6
- package/dist/mcp-prompt-streaming-DDWQ-FCA.js.map +1 -0
- package/dist/{mint-failure-D4nd2XmZ.js → mint-failure-u8xQKNOn.js} +689 -126
- package/dist/mint-failure-u8xQKNOn.js.map +1 -0
- package/dist/{models-DDdBJKwT.js → models-WcwUnSKb.js} +2 -2
- package/dist/{models-DDdBJKwT.js.map → models-WcwUnSKb.js.map} +1 -1
- package/dist/{non-interactive-Dzow7YKY.js → non-interactive-DyVC1AGc.js} +4 -3
- package/dist/{non-interactive-Dzow7YKY.js.map → non-interactive-DyVC1AGc.js.map} +1 -1
- package/dist/{oauth-session-DJ8h6GFa.js → oauth-session-DYM2Hrl2.js} +2 -2
- package/dist/{oauth-session-DJ8h6GFa.js.map → oauth-session-DYM2Hrl2.js.map} +1 -1
- package/dist/{orchestrator-tools-szcdscwn.js → orchestrator-tools-DbgNBFGA.js} +3 -3
- package/dist/{orchestrator-tools-szcdscwn.js.map → orchestrator-tools-DbgNBFGA.js.map} +1 -1
- package/dist/{package-json-DY70kkNp.js → package-json-Atg34fa4.js} +2 -8
- package/dist/{package-json-DY70kkNp.js.map → package-json-Atg34fa4.js.map} +1 -1
- package/dist/package-json-D8Ga03tK.js +2 -0
- package/dist/{pi-D3h5Ok0i.js → pi-8KsYsPmM.js} +145 -45
- package/dist/pi-8KsYsPmM.js.map +1 -0
- package/dist/{playground-5AB4WgNF.js → playground-BlYRBMj7.js} +11 -11
- package/dist/playground-BlYRBMj7.js.map +1 -0
- package/dist/{posthog-DNn574nW.js → posthog-Bt0Aplb8.js} +4 -9
- package/dist/posthog-Bt0Aplb8.js.map +1 -0
- package/dist/posthog-CUgCEhH0.js +2 -0
- package/dist/{provisioning-B8uSqRZk.js → provisioning-Bo2NRxFz.js} +5 -11
- package/dist/{provisioning-B8uSqRZk.js.map → provisioning-Bo2NRxFz.js.map} +1 -1
- package/dist/provisioning-OGFGlzf7.js +2 -0
- package/dist/{queue-tools-9OOVx5TE.js → queue-tools-C8mXOh7e.js} +3 -3
- package/dist/{queue-tools-9OOVx5TE.js.map → queue-tools-C8mXOh7e.js.map} +1 -1
- package/dist/registry-C06e_x-p.js +2 -0
- package/dist/{registry-8YG-kuXk.js → registry-CD5RQt38.js} +51 -53
- package/dist/registry-CD5RQt38.js.map +1 -0
- package/dist/run-agent-legacy-ChacZImU.js +2 -0
- package/dist/{run-agent-legacy-d7rWlzQR.js → run-agent-legacy-DOlM6DQu.js} +823 -1022
- package/dist/run-agent-legacy-DOlM6DQu.js.map +1 -0
- package/dist/runners-ov3EXF1n.js +834 -0
- package/dist/runners-ov3EXF1n.js.map +1 -0
- package/dist/{security-Cg_4a7vB.js → security-C71pkwqH.js} +16 -6
- package/dist/security-C71pkwqH.js.map +1 -0
- package/dist/{setup-utils-CmTCTPkX.js → setup-utils-B26Lf2yF.js} +12 -22
- package/dist/setup-utils-B26Lf2yF.js.map +1 -0
- package/dist/setup-utils-CVS86NYR.js +2 -0
- package/dist/{start-tui-CB2PZs1x.js → start-tui-Bo2L0bar.js} +30 -28
- package/dist/start-tui-Bo2L0bar.js.map +1 -0
- package/dist/{steps-BZcXRJNY.js → steps-BPcg3_3Q.js} +7 -7
- package/dist/{steps-BZcXRJNY.js.map → steps-BPcg3_3Q.js.map} +1 -1
- package/dist/{store-UN7c-ASf.js → store-BTzcvRGT.js} +12 -18
- package/dist/store-BTzcvRGT.js.map +1 -0
- package/dist/store-BpqySPXm.js +5 -0
- package/dist/{subagent-BofIDK-O.js → subagent-D1TrTchE.js} +3 -3
- package/dist/{subagent-BofIDK-O.js.map → subagent-D1TrTchE.js.map} +1 -1
- package/dist/{task-r9t1UhQP.js → task-DqRlQBfs.js} +18 -16
- package/dist/task-DqRlQBfs.js.map +1 -0
- package/dist/{task-stream-CMUilu54.js → task-stream-Bw6JaLCX.js} +10 -10
- package/dist/task-stream-Bw6JaLCX.js.map +1 -0
- package/dist/{tasks-Bbv_lOBG.js → tasks-ChWufsdO.js} +1 -1
- package/dist/{tasks-Bbv_lOBG.js.map → tasks-ChWufsdO.js.map} +1 -1
- package/dist/{telemetry-D6ruCtnv.js → telemetry-B7zJdRmA.js} +3 -3
- package/dist/{telemetry-D6ruCtnv.js.map → telemetry-B7zJdRmA.js.map} +1 -1
- package/dist/{terminal-DrGyci_a.js → terminal-zgkEfoCL.js} +17 -17
- package/dist/terminal-zgkEfoCL.js.map +1 -0
- package/dist/{tools-Dyfh9aCD.js → tools-CkJ2y9Wt.js} +9 -9
- package/dist/tools-CkJ2y9Wt.js.map +1 -0
- package/dist/{ui-BBVuTM1v.js → ui-Q6-RvERF.js} +3 -3
- package/dist/{ui-BBVuTM1v.js.map → ui-Q6-RvERF.js.map} +1 -1
- package/dist/{version-aXxpgRKx.js → version-CHhJjz_H.js} +2 -2
- package/dist/{version-aXxpgRKx.js.map → version-CHhJjz_H.js.map} +1 -1
- package/dist/{wizard-abort-BBkiUxfS.js → wizard-abort-BPdv07np.js} +7 -6
- package/dist/{wizard-abort-BBkiUxfS.js.map → wizard-abort-BPdv07np.js.map} +1 -1
- package/dist/wizard-abort-Br1qMDNa.js +3 -0
- package/dist/wizard-session-2w4Ru-Wz.js.map +1 -1
- package/dist/{wizard-ui-DoyOZxK8.js → wizard-ui-DVqrYaOM.js} +1 -1
- package/dist/{wizard-ui-DoyOZxK8.js.map → wizard-ui-DVqrYaOM.js.map} +1 -1
- package/dist/{yara-hooks-DCeMDd1o.js → yara-hooks-BnxejtXK.js} +5 -5
- package/dist/{yara-hooks-DCeMDd1o.js.map → yara-hooks-BnxejtXK.js.map} +1 -1
- package/dist/yara-hooks-DSuExwb4.js +2 -0
- package/package.json +2 -1
- package/dist/agent-bCZ3i3fh.js.map +0 -1
- package/dist/agent-interface-BAOIHuXS.js.map +0 -1
- package/dist/analytics-BcV-WCM4.js +0 -2
- package/dist/ci-install-CDdQYsPe.js.map +0 -1
- package/dist/errors-CQ9kttJD.js +0 -185
- package/dist/errors-CQ9kttJD.js.map +0 -1
- package/dist/file-BcLTjU16.js.map +0 -1
- package/dist/gateway-CjoShdLa.js.map +0 -1
- package/dist/interactive-D6zV7brJ.js.map +0 -1
- package/dist/mcp-prompt-streaming-I2U_X7BC.js.map +0 -1
- package/dist/mint-failure-D4nd2XmZ.js.map +0 -1
- package/dist/pi-D3h5Ok0i.js.map +0 -1
- package/dist/playground-5AB4WgNF.js.map +0 -1
- package/dist/posthog-DNn574nW.js.map +0 -1
- package/dist/registry-8YG-kuXk.js.map +0 -1
- package/dist/rolldown-runtime-B_-DWIq7.js +0 -15
- package/dist/run-agent-legacy-d7rWlzQR.js.map +0 -1
- package/dist/security-Cg_4a7vB.js.map +0 -1
- package/dist/setup-utils-CmTCTPkX.js.map +0 -1
- package/dist/start-tui-CB2PZs1x.js.map +0 -1
- package/dist/store-UN7c-ASf.js.map +0 -1
- package/dist/task-r9t1UhQP.js.map +0 -1
- package/dist/task-stream-CMUilu54.js.map +0 -1
- package/dist/terminal-DrGyci_a.js.map +0 -1
- package/dist/tools-Dyfh9aCD.js.map +0 -1
- package/dist/wizard-abort-BU4aLyvh.js +0 -3
- package/dist/yara-hooks-DSGuCU9A.js +0 -2
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { i as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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
|
-
|
|
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
|
-
/**
|
|
1633
|
-
|
|
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/
|
|
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:
|
|
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 {
|
|
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-
|
|
4092
|
+
//# sourceMappingURL=agent-interface-FkbaBJwz.js.map
|