@posthog/wizard 2.66.0 → 2.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-mcp-server-to-clients-DWDEuDUR.js → add-mcp-server-to-clients-DHTRbyJX.js} +25 -25
- package/dist/{add-mcp-server-to-clients-DWDEuDUR.js.map → add-mcp-server-to-clients-DHTRbyJX.js.map} +1 -1
- package/dist/{agent-interface-D3MNaDp3.js → agent-interface-tM_b0l__.js} +130 -41
- package/dist/agent-interface-tM_b0l__.js.map +1 -0
- package/dist/{agent-prompt-loader-D8Bajo-L.js → agent-prompt-loader-BSMh5bfD.js} +5 -5
- package/dist/{agent-prompt-loader-D8Bajo-L.js.map → agent-prompt-loader-BSMh5bfD.js.map} +1 -1
- package/dist/{agent-runner-DEeMqJxy.js → agent-runner-DD65OMkB.js} +67 -36
- package/dist/agent-runner-DD65OMkB.js.map +1 -0
- package/dist/analytics-B4Igh5nv.js +2 -0
- package/dist/{analytics-D8JNuPAT.js → analytics-CtIYzkK4.js} +2 -2
- package/dist/{analytics-D8JNuPAT.js.map → analytics-CtIYzkK4.js.map} +1 -1
- package/dist/{api-CemGgyBv.js → api-BJft9v6K.js} +3 -3
- package/dist/{api-CemGgyBv.js.map → api-BJft9v6K.js.map} +1 -1
- package/dist/bin.js +200 -85
- package/dist/bin.js.map +1 -1
- package/dist/{bounded-fs-C6OjqZst.js → bounded-fs-BWqoFQvQ.js} +3 -3
- package/dist/{bounded-fs-C6OjqZst.js.map → bounded-fs-BWqoFQvQ.js.map} +1 -1
- package/dist/{ci-install-DIB2n4Ju.js → ci-install-BXGnVI7T.js} +18 -9
- package/dist/ci-install-BXGnVI7T.js.map +1 -0
- package/dist/{debug-BKqv-yfT.js → debug-BsHD83Vy.js} +4 -4
- package/dist/debug-BsHD83Vy.js.map +1 -0
- package/dist/{debug-H-GTKvvU.js → debug-mO3yg4Z7.js} +1 -1
- package/dist/{defaults-BHhXrX9F.js → defaults-DI642M3n.js} +1 -1
- package/dist/{defaults-BHhXrX9F.js.map → defaults-DI642M3n.js.map} +1 -1
- package/dist/{env-api-key-CzHDwfV2.js → env-api-key-DS0ghlcO.js} +2 -2
- package/dist/{env-api-key-CzHDwfV2.js.map → env-api-key-DS0ghlcO.js.map} +1 -1
- package/dist/{environment-Cl-fIQku.js → environment-C7CKGIOE.js} +4 -4
- package/dist/{environment-Cl-fIQku.js.map → environment-C7CKGIOE.js.map} +1 -1
- package/dist/errors-BHervYGs.js +156 -0
- package/dist/errors-BHervYGs.js.map +1 -0
- package/dist/{file-watcher-Cr-4tA-e.js → file-watcher-D1bdo9mq.js} +2 -2
- package/dist/{file-watcher-Cr-4tA-e.js.map → file-watcher-D1bdo9mq.js.map} +1 -1
- package/dist/{headless-ui-DT3Db1bk.js → headless-ui-6QuByWZ_.js} +2 -2
- package/dist/{headless-ui-DT3Db1bk.js.map → headless-ui-6QuByWZ_.js.map} +1 -1
- package/dist/{interactive-D3LdFxZG.js → interactive-DUpW84WU.js} +2 -2
- package/dist/{interactive-D3LdFxZG.js.map → interactive-DUpW84WU.js.map} +1 -1
- package/dist/{local-dev-BN6NKQ0B.js → local-dev-DPZiIPCK.js} +1 -1
- package/dist/{local-dev-BN6NKQ0B.js.map → local-dev-DPZiIPCK.js.map} +1 -1
- package/dist/{mcp-BjckYQmP.js → mcp-CHo9h-WV.js} +2 -2
- package/dist/{mcp-BjckYQmP.js.map → mcp-CHo9h-WV.js.map} +1 -1
- package/dist/{mcp-prompt-streaming--sRErHKv.js → mcp-prompt-streaming-CHRPxxd0.js} +4 -4
- package/dist/{mcp-prompt-streaming--sRErHKv.js.map → mcp-prompt-streaming-CHRPxxd0.js.map} +1 -1
- package/dist/{non-interactive-CNoYoEZp.js → non-interactive-Cr-chffe.js} +7 -2
- package/dist/non-interactive-Cr-chffe.js.map +1 -0
- package/dist/{orchestrator-tools-8bGyDDhn.js → orchestrator-tools-Tx18_TMb.js} +3 -3
- package/dist/{orchestrator-tools-8bGyDDhn.js.map → orchestrator-tools-Tx18_TMb.js.map} +1 -1
- package/dist/{package-json-D0DCWpe5.js → package-json-GEU2VZlS.js} +1 -1
- package/dist/{package-json-D0DCWpe5.js.map → package-json-GEU2VZlS.js.map} +1 -1
- package/dist/{package-manager-BQDHm7ER.js → package-manager-CLfc31yf.js} +4 -4
- package/dist/package-manager-CLfc31yf.js.map +1 -0
- package/dist/{pi-W-4RUPFY.js → pi-RlnYUHdb.js} +12 -11
- package/dist/{pi-W-4RUPFY.js.map → pi-RlnYUHdb.js.map} +1 -1
- package/dist/{playground-uHHgZChe.js → playground-DQ633rje.js} +7 -7
- package/dist/{playground-uHHgZChe.js.map → playground-DQ633rje.js.map} +1 -1
- package/dist/{posthog-ChzdlmCs.js → posthog-DSn9bIZc.js} +2 -2
- package/dist/{posthog-ChzdlmCs.js.map → posthog-DSn9bIZc.js.map} +1 -1
- package/dist/{posthog-integration-LxEBGkoe.js → posthog-integration-DFfBRGOC.js} +21 -17
- package/dist/{posthog-integration-LxEBGkoe.js.map → posthog-integration-DFfBRGOC.js.map} +1 -1
- package/dist/{provisioning-BHTl91OZ.js → provisioning-Cvy_vQHV.js} +3 -3
- package/dist/{provisioning-BHTl91OZ.js.map → provisioning-Cvy_vQHV.js.map} +1 -1
- package/dist/{queue-tools-DABh1Ssc.js → queue-tools-BC9HxOV6.js} +3 -3
- package/dist/{queue-tools-DABh1Ssc.js.map → queue-tools-BC9HxOV6.js.map} +1 -1
- package/dist/{registry-CxNpCNAj.js → registry-DCAElOyj.js} +81 -81
- package/dist/{registry-CxNpCNAj.js.map → registry-DCAElOyj.js.map} +1 -1
- package/dist/{security-B4jU_-7q.js → security-CuSX3XVo.js} +21 -9
- package/dist/security-CuSX3XVo.js.map +1 -0
- package/dist/{setup-utils-aWZEdfwh.js → setup-utils-D1tv0v_R.js} +13 -13
- package/dist/{setup-utils-aWZEdfwh.js.map → setup-utils-D1tv0v_R.js.map} +1 -1
- package/dist/{start-tui-BQH4mQIZ.js → start-tui-B5YfmqNr.js} +33 -23
- package/dist/start-tui-B5YfmqNr.js.map +1 -0
- package/dist/{steps-5HAqjUvn.js → steps-CLaSMwfR.js} +7 -7
- package/dist/{steps-5HAqjUvn.js.map → steps-CLaSMwfR.js.map} +1 -1
- package/dist/{store-P_7zUfbj.js → store-DzEgsAPN.js} +5 -5
- package/dist/{store-P_7zUfbj.js.map → store-DzEgsAPN.js.map} +1 -1
- package/dist/{subagent-uGPDXPfS.js → subagent-BUV6aD7p.js} +2 -2
- package/dist/{subagent-uGPDXPfS.js.map → subagent-BUV6aD7p.js.map} +1 -1
- package/dist/{task-oh8OAnvR.js → task-GnWId75q.js} +13 -12
- package/dist/{task-oh8OAnvR.js.map → task-GnWId75q.js.map} +1 -1
- package/dist/{task-stream-jUARpyB5.js → task-stream-DSzvwJrD.js} +16 -9
- package/dist/task-stream-DSzvwJrD.js.map +1 -0
- package/dist/{tasks-2mu3lAvm.js → tasks-BO0W8ocx.js} +2 -2
- package/dist/{tasks-2mu3lAvm.js.map → tasks-BO0W8ocx.js.map} +1 -1
- package/dist/{telemetry-BllPiBKw.js → telemetry-Vi9dWddJ.js} +3 -3
- package/dist/{telemetry-BllPiBKw.js.map → telemetry-Vi9dWddJ.js.map} +1 -1
- package/dist/{terminal-aWQrDy8s.js → terminal-B5wZK7aS.js} +13 -13
- package/dist/{terminal-aWQrDy8s.js.map → terminal-B5wZK7aS.js.map} +1 -1
- package/dist/{tools-u8TaJFqa.js → tools-C9cNluqc.js} +6 -6
- package/dist/{tools-u8TaJFqa.js.map → tools-C9cNluqc.js.map} +1 -1
- package/dist/{wizard-abort-pFFH7dcx.js → wizard-abort-BsNbguJt.js} +1 -1
- package/dist/wizard-abort-CGv3lVxw.js +71 -0
- package/dist/wizard-abort-CGv3lVxw.js.map +1 -0
- package/dist/{wizard-session-DTyLMPsX.js → wizard-session-Cex1BiXs.js} +2 -2
- package/dist/wizard-session-Cex1BiXs.js.map +1 -0
- package/dist/{wizard-session-Cw7-_OcZ.js → wizard-session-DHbUcjI7.js} +1 -1
- package/dist/yara-hooks-C3Vm2Gow.js +2 -0
- package/dist/{yara-hooks-BXDBIOBq.js → yara-hooks-DZIVzhA6.js} +57 -8
- package/dist/yara-hooks-DZIVzhA6.js.map +1 -0
- package/package.json +1 -1
- package/dist/agent-interface-D3MNaDp3.js.map +0 -1
- package/dist/agent-runner-DEeMqJxy.js.map +0 -1
- package/dist/analytics-DN3Kzf7H.js +0 -2
- package/dist/ci-install-DIB2n4Ju.js.map +0 -1
- package/dist/debug-BKqv-yfT.js.map +0 -1
- package/dist/non-interactive-CNoYoEZp.js.map +0 -1
- package/dist/package-manager-BQDHm7ER.js.map +0 -1
- package/dist/security-B4jU_-7q.js.map +0 -1
- package/dist/start-tui-BQH4mQIZ.js.map +0 -1
- package/dist/task-stream-jUARpyB5.js.map +0 -1
- package/dist/wizard-abort-D9jiMkZA.js +0 -49
- package/dist/wizard-abort-D9jiMkZA.js.map +0 -1
- package/dist/wizard-session-DTyLMPsX.js.map +0 -1
- package/dist/yara-hooks-BXDBIOBq.js.map +0 -1
- package/dist/yara-hooks-i2jOabhI.js +0 -2
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { n as __require } from "./rolldown-runtime-B_-DWIq7.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { a as AgentSignals, o as REMARK_INSTRUCTION, s as classifyAuthFailure } from "./errors-BHervYGs.js";
|
|
3
|
+
import { G as POSTHOG_FLAG_HEADER_PREFIX, J as POSTHOG_PROPERTY_HEADER_PREFIX, a as getLogFilePath, dt as WIZARD_REMARK_EVENT_NAME, f as getUI, ht as wizardUserAgentForProgram, o as initLogFile, r as debug, s as logToFile, xt as runtimeEnv } from "./debug-BsHD83Vy.js";
|
|
4
|
+
import { n as analytics } from "./analytics-CtIYzkK4.js";
|
|
5
|
+
import { a as safeReadFile, i as readProjectFile, o as walkProjectFiles } from "./bounded-fs-BWqoFQvQ.js";
|
|
6
|
+
import { n as ADDITIONAL_FEATURE_PROMPTS } from "./wizard-session-Cex1BiXs.js";
|
|
7
|
+
import { i as wizardAbort, n as registerCleanup, t as WizardError } from "./wizard-abort-CGv3lVxw.js";
|
|
8
|
+
import { _ as modelCapabilities, m as writeJsonAtomic, o as buildOrchestratorTools, p as makeMutex, y as triageModelFor } from "./queue-tools-BC9HxOV6.js";
|
|
9
|
+
import { b as coerceAuditChecks, g as AUDIT_CHECKS_FILE, l as prewarmYaraScanner, n as createPostToolUseYaraHooks, p as scanInstalledSkill, r as createPreToolUseYaraHooks } from "./yara-hooks-DZIVzhA6.js";
|
|
9
10
|
import { createRequire } from "node:module";
|
|
10
11
|
import * as fs$1 from "fs";
|
|
11
12
|
import fs from "fs";
|
|
12
13
|
import path from "path";
|
|
14
|
+
import path$1 from "node:path";
|
|
13
15
|
import { spawnSync } from "node:child_process";
|
|
16
|
+
import { closeSync, constants, fchmodSync, lstatSync, openSync, renameSync, unlinkSync, writeSync } from "node:fs";
|
|
17
|
+
import { randomBytes } from "node:crypto";
|
|
14
18
|
import { z } from "zod";
|
|
15
19
|
import * as os from "os";
|
|
16
20
|
import { unzipSync } from "fflate";
|
|
@@ -1462,8 +1466,68 @@ const WIZARD_TOOL_NAMES = {
|
|
|
1462
1466
|
const MAX_HANDOFF_TEXT_CHARS = 64 * 1024;
|
|
1463
1467
|
const PUBLISH_HANDOFF_TOOL_NAME = "publish_handoff";
|
|
1464
1468
|
/** Shared between the MCP server and the pi facade so the contract can't drift. */
|
|
1465
|
-
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
|
|
1469
|
+
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.";
|
|
1466
1470
|
const PUBLISH_HANDOFF_CONTENT_DESCRIPTION = "The complete handoff report as markdown, starting with an H1 heading.";
|
|
1471
|
+
/**
|
|
1472
|
+
* Write the handoff report to the host-designated `targetPath`.
|
|
1473
|
+
*
|
|
1474
|
+
* The destination comes from the host (`POSTHOG_HANDOFF_OUTPUT_PATH`,
|
|
1475
|
+
* process-env only — the agent can neither set nor see it) while the bytes come
|
|
1476
|
+
* from the agent, so the write is treated as a trust-boundary crossing:
|
|
1477
|
+
* - relative paths are refused (a relative destination would silently resolve
|
|
1478
|
+
* against whatever CWD the wizard happens to run in);
|
|
1479
|
+
* - a pre-existing non-regular destination (symlink, directory, FIFO, device)
|
|
1480
|
+
* is refused, so a primed symlink can't redirect the write at another file;
|
|
1481
|
+
* - content lands in a unique sibling temp file opened with O_NOFOLLOW |
|
|
1482
|
+
* O_EXCL and is then rename()d over the destination — atomic for a polling
|
|
1483
|
+
* reader, and rename replaces the *link* rather than following it;
|
|
1484
|
+
* - the final file is chmod'd to 0o600 even when the host pre-created it with
|
|
1485
|
+
* looser permissions (the report quotes the user's code).
|
|
1486
|
+
*
|
|
1487
|
+
* `reason` is safe to surface to the agent (it names no path); `detail` carries
|
|
1488
|
+
* the specifics for the local log only.
|
|
1489
|
+
*/
|
|
1490
|
+
function writeHandoffFileAtomically(targetPath, text) {
|
|
1491
|
+
if (!path$1.isAbsolute(targetPath)) return {
|
|
1492
|
+
ok: false,
|
|
1493
|
+
reason: "destination is not an absolute path",
|
|
1494
|
+
detail: `relative destination refused: ${targetPath}`
|
|
1495
|
+
};
|
|
1496
|
+
let stat;
|
|
1497
|
+
try {
|
|
1498
|
+
stat = lstatSync(targetPath);
|
|
1499
|
+
} catch {
|
|
1500
|
+
stat = void 0;
|
|
1501
|
+
}
|
|
1502
|
+
if (stat && !stat.isFile()) return {
|
|
1503
|
+
ok: false,
|
|
1504
|
+
reason: "destination is not a regular file",
|
|
1505
|
+
detail: `non-regular destination refused: ${targetPath}`
|
|
1506
|
+
};
|
|
1507
|
+
const tmpPath = `${targetPath}.tmp-${process.pid}-${randomBytes(6).toString("hex")}`;
|
|
1508
|
+
let fd;
|
|
1509
|
+
try {
|
|
1510
|
+
fd = openSync(tmpPath, constants.O_WRONLY | constants.O_CREAT | constants.O_TRUNC | constants.O_NOFOLLOW | constants.O_EXCL, 384);
|
|
1511
|
+
writeSync(fd, text, null, "utf8");
|
|
1512
|
+
fchmodSync(fd, 384);
|
|
1513
|
+
closeSync(fd);
|
|
1514
|
+
fd = void 0;
|
|
1515
|
+
renameSync(tmpPath, targetPath);
|
|
1516
|
+
return { ok: true };
|
|
1517
|
+
} catch (err) {
|
|
1518
|
+
if (fd !== void 0) try {
|
|
1519
|
+
closeSync(fd);
|
|
1520
|
+
} catch {}
|
|
1521
|
+
try {
|
|
1522
|
+
unlinkSync(tmpPath);
|
|
1523
|
+
} catch {}
|
|
1524
|
+
return {
|
|
1525
|
+
ok: false,
|
|
1526
|
+
reason: (typeof err === "object" && err !== null && "code" in err ? String(err.code) : void 0) ?? "write error",
|
|
1527
|
+
detail: err instanceof Error ? err.message : String(err)
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1467
1531
|
function publishHandoff(content) {
|
|
1468
1532
|
if (content.trim() === "") {
|
|
1469
1533
|
analytics.wizardCapture("handoff published", {
|
|
@@ -1478,14 +1542,29 @@ function publishHandoff(content) {
|
|
|
1478
1542
|
const truncated = content.length > MAX_HANDOFF_TEXT_CHARS;
|
|
1479
1543
|
const text = truncated ? content.slice(0, MAX_HANDOFF_TEXT_CHARS) : content;
|
|
1480
1544
|
getUI().setHandoffText(text);
|
|
1545
|
+
const handoffOutputPath = runtimeEnv("POSTHOG_HANDOFF_OUTPUT_PATH");
|
|
1546
|
+
let handoffOutputWritten;
|
|
1547
|
+
let handoffOutputError;
|
|
1548
|
+
if (handoffOutputPath) {
|
|
1549
|
+
const write = writeHandoffFileAtomically(handoffOutputPath, text);
|
|
1550
|
+
handoffOutputWritten = write.ok;
|
|
1551
|
+
if (!write.ok) {
|
|
1552
|
+
handoffOutputError = write.reason;
|
|
1553
|
+
logToFile(`[publish_handoff] host output write failed (${write.reason}): ${write.detail}`);
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1481
1556
|
analytics.wizardCapture("handoff published", {
|
|
1482
1557
|
handoff_ok: true,
|
|
1483
1558
|
handoff_chars: text.length,
|
|
1484
|
-
handoff_truncated: truncated
|
|
1559
|
+
handoff_truncated: truncated,
|
|
1560
|
+
handoff_output_written: handoffOutputWritten
|
|
1485
1561
|
});
|
|
1562
|
+
const notes = [];
|
|
1563
|
+
if (truncated) notes.push("truncated to the 64 KB limit");
|
|
1564
|
+
if (handoffOutputError) notes.push(`host output write failed: ${handoffOutputError}`);
|
|
1486
1565
|
return {
|
|
1487
1566
|
ok: true,
|
|
1488
|
-
message: `Handoff published (${text.length} chars${
|
|
1567
|
+
message: `Handoff published (${text.length} chars${notes.length > 0 ? `, ${notes.join("; ")}` : ""}).`
|
|
1489
1568
|
};
|
|
1490
1569
|
}
|
|
1491
1570
|
//#endregion
|
|
@@ -2032,31 +2111,6 @@ function classifyToolToStage(toolName) {
|
|
|
2032
2111
|
return null;
|
|
2033
2112
|
}
|
|
2034
2113
|
//#endregion
|
|
2035
|
-
//#region src/lib/agent/signals.ts
|
|
2036
|
-
/**
|
|
2037
|
-
* Agent signal vocabulary — the marker strings the agent emits and the error
|
|
2038
|
-
* taxonomy the runner returns. Kept as a dependency-free leaf module so both
|
|
2039
|
-
* `agent-interface.ts` and `output-signals.ts` can import it without a cycle.
|
|
2040
|
-
*/
|
|
2041
|
-
const AgentSignals = {
|
|
2042
|
-
STATUS: "[STATUS]",
|
|
2043
|
-
ERROR_MCP_MISSING: "[ERROR-MCP-MISSING]",
|
|
2044
|
-
ERROR_RESOURCE_MISSING: "[ERROR-RESOURCE-MISSING]",
|
|
2045
|
-
SKILL_INSTALL_FAILED: "[SKILL-INSTALL-FAILED]",
|
|
2046
|
-
ABORT: "[ABORT]",
|
|
2047
|
-
WIZARD_REMARK: "[WIZARD-REMARK]",
|
|
2048
|
-
BENCHMARK: "[BENCHMARK]",
|
|
2049
|
-
DASHBOARD_URL: "[DASHBOARD_URL]",
|
|
2050
|
-
NOTEBOOK_URL: "[NOTEBOOK_URL]"
|
|
2051
|
-
};
|
|
2052
|
-
/**
|
|
2053
|
-
* End-of-run reflection ask, shared by both harnesses so remarks are
|
|
2054
|
-
* comparable. The format clause comes FIRST and nothing trails the marker —
|
|
2055
|
-
* literal models (gpt-5-mini) echo whatever text follows it. The parser also
|
|
2056
|
-
* drops remarks that quote this instruction (see AgentOutputSignals.remark).
|
|
2057
|
-
*/
|
|
2058
|
-
const REMARK_INSTRUCTION = `Reply with a single line that starts with ${AgentSignals.WIZARD_REMARK} and no other lines. In that line, state briefly what information or guidance would have been useful to have in the integration prompt or documentation for this run — specifically anything that would have prevented tool failures, erroneous edits, or other wasted turns.`;
|
|
2059
|
-
//#endregion
|
|
2060
2114
|
//#region src/lib/agent/output-signals.ts
|
|
2061
2115
|
/**
|
|
2062
2116
|
* Parses the signal-bearing lines out of agent output and discards the rest.
|
|
@@ -2196,6 +2250,32 @@ const PROVIDER_ENV_NAMESPACE = /^(ANTHROPIC_|CLAUDE_CODE_)/;
|
|
|
2196
2250
|
*/
|
|
2197
2251
|
const BLOCKED_OFF_NAMESPACE_KEYS = new Set(["AWS_BEARER_TOKEN_BEDROCK"]);
|
|
2198
2252
|
/**
|
|
2253
|
+
* Host-orchestration values read only by the wizard process itself (via
|
|
2254
|
+
* `runtimeEnv` in src/env.ts). None of them is ever consumed by the spawned
|
|
2255
|
+
* agent subprocess — the `publish_handoff` MCP tool executes in the wizard's
|
|
2256
|
+
* own process — so the subprocess only ever loses attack surface:
|
|
2257
|
+
*
|
|
2258
|
+
* - `POSTHOG_HANDOFF_OUTPUT_PATH` names the host file the wizard writes the
|
|
2259
|
+
* agent's handoff report to. Handing it to the subprocess tells a
|
|
2260
|
+
* (prompt-injected) agent exactly which file its own report content lands
|
|
2261
|
+
* in, turning the write into a pre-plantable symlink/same-UID overwrite
|
|
2262
|
+
* target. The write itself refuses symlinks, but the agent has no business
|
|
2263
|
+
* knowing the destination at all.
|
|
2264
|
+
* - `POSTHOG_TASK_RUN_ID` / `POSTHOG_TASK_ID` identify the sandbox run and are
|
|
2265
|
+
* read by the wizard's analytics only; they let the agent fingerprint the
|
|
2266
|
+
* run directory where the handoff path typically sits.
|
|
2267
|
+
*
|
|
2268
|
+
* Deliberately NOT stripped: `POSTHOG_API_KEY` / `POSTHOG_HOST` — pre-existing
|
|
2269
|
+
* passthrough that the agent may rely on when writing the user's project key
|
|
2270
|
+
* into the project's own .env. Changing that disposition is a separate,
|
|
2271
|
+
* deliberate decision, not part of this hardening.
|
|
2272
|
+
*/
|
|
2273
|
+
const HOST_ONLY_ENV_KEYS = new Set([
|
|
2274
|
+
"POSTHOG_HANDOFF_OUTPUT_PATH",
|
|
2275
|
+
"POSTHOG_TASK_RUN_ID",
|
|
2276
|
+
"POSTHOG_TASK_ID"
|
|
2277
|
+
]);
|
|
2278
|
+
/**
|
|
2199
2279
|
* Credential / routing knobs that, set in an on-disk Claude **settings** `env`
|
|
2200
2280
|
* block, redirect the binary. A settings file is applied by the binary itself,
|
|
2201
2281
|
* so the subprocess-env strip below cannot remove it — `claude-settings.ts`
|
|
@@ -2255,10 +2335,11 @@ const BLOCKED_AGENT_ENV_PATTERNS = [/^CLAUDE_CODE_SKIP_.+_AUTH$/, /^ANTHROPIC_.+
|
|
|
2255
2335
|
/**
|
|
2256
2336
|
* True if `key` must NOT be inherited by the agent subprocess: anything in the
|
|
2257
2337
|
* provider namespace (the wizard re-injects its own values at the spawn site),
|
|
2258
|
-
*
|
|
2338
|
+
* the lone off-namespace credential, and host-only orchestration values the
|
|
2339
|
+
* subprocess never reads.
|
|
2259
2340
|
*/
|
|
2260
2341
|
function isBlockedAgentEnvKey(key) {
|
|
2261
|
-
return PROVIDER_ENV_NAMESPACE.test(key) || BLOCKED_OFF_NAMESPACE_KEYS.has(key);
|
|
2342
|
+
return PROVIDER_ENV_NAMESPACE.test(key) || BLOCKED_OFF_NAMESPACE_KEYS.has(key) || HOST_ONLY_ENV_KEYS.has(key);
|
|
2262
2343
|
}
|
|
2263
2344
|
/**
|
|
2264
2345
|
* Return a copy of `env` with the entire model-provider namespace removed, so
|
|
@@ -3072,7 +3153,7 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
|
|
|
3072
3153
|
if (options.debug) debug("CLI stderr:", data);
|
|
3073
3154
|
},
|
|
3074
3155
|
hooks: {
|
|
3075
|
-
PreToolUse: warlockDisabled ? [] : createPreToolUseYaraHooks(triageProvider),
|
|
3156
|
+
PreToolUse: warlockDisabled ? [] : createPreToolUseYaraHooks(triageProvider, onYaraTerminate),
|
|
3076
3157
|
PostToolUse: warlockDisabled ? [] : createPostToolUseYaraHooks(triageProvider, onYaraTerminate),
|
|
3077
3158
|
Stop: [{
|
|
3078
3159
|
hooks: [createStopHook(config?.additionalFeatureQueue ?? [], signals, config?.requestRemark ?? true)],
|
|
@@ -3120,6 +3201,13 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
|
|
|
3120
3201
|
signalDone();
|
|
3121
3202
|
spinner.stop("Authentication failed");
|
|
3122
3203
|
const authError = buildAuthErrorContext(options.installDir, process.env.ANTHROPIC_BASE_URL ?? "", os.homedir(), signals.apiKeySource);
|
|
3204
|
+
const authCode = classifyAuthFailure({
|
|
3205
|
+
hasSettingsConflict: authError.hasSettingsConflict,
|
|
3206
|
+
usingManagedLogin: authError.usingManagedLogin,
|
|
3207
|
+
apiKey: options.apiKey,
|
|
3208
|
+
gatewayRegion: authError.region,
|
|
3209
|
+
sessionRegion: options.cloudRegion
|
|
3210
|
+
});
|
|
3123
3211
|
logToFile("Agent error: 401, showing auth error screen", authError);
|
|
3124
3212
|
getUI().showAuthError({
|
|
3125
3213
|
hasSettingsConflict: authError.hasSettingsConflict,
|
|
@@ -3129,6 +3217,7 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
|
|
|
3129
3217
|
logFilePath: getLogFilePath()
|
|
3130
3218
|
});
|
|
3131
3219
|
await wizardAbort({
|
|
3220
|
+
code: authCode,
|
|
3132
3221
|
message: "Authentication failed (401)",
|
|
3133
3222
|
error: new WizardError("Authentication failed", {
|
|
3134
3223
|
hasSettingsConflict: authError.hasSettingsConflict,
|
|
@@ -3138,7 +3227,7 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
|
|
|
3138
3227
|
region: authError.region,
|
|
3139
3228
|
usingManagedLogin: authError.usingManagedLogin,
|
|
3140
3229
|
apiKeySource: authError.apiKeySource
|
|
3141
|
-
})
|
|
3230
|
+
}, authCode)
|
|
3142
3231
|
});
|
|
3143
3232
|
}
|
|
3144
3233
|
try {
|
|
@@ -3483,6 +3572,6 @@ function handleSDKMessage(message, options, spinner, signals, receivedSuccessRes
|
|
|
3483
3572
|
}
|
|
3484
3573
|
}
|
|
3485
3574
|
//#endregion
|
|
3486
|
-
export {
|
|
3575
|
+
export { installSkillById as A, isEnvFileName as B, WIZARD_ASK_SUBJECT_DESCRIPTION as C, createAskAccounting as D, checkEnvKeys as E, vaultSensitiveAnswers as F, buildGatewayProvider as G, toPromptSafeRelativePath as H, fetchWithRetry as I, createWizardAskBridge as L, resolveEnvPath as M, resolveEnvSecretRefs as N, downloadSkill as O, templateEnvWriteRefusal as P, isFullyCancelled as R, WIZARD_ASK_SENSITIVE_DESCRIPTION as S, WIZARD_TOOL_NAMES as T, createTriageLLMProvider as U, parseEnvKeyNames as V, GATEWAY_PROVIDER as W, PUBLISH_HANDOFF_TOOL_NAME as _, wizardCanUseTool as a, CHECK_ENV_KEYS_FILE_PATH_DESCRIPTION as b, classifySettingsConflicts as c, sanitizeAgentSubprocessEnv as d, AgentOutputSignals as f, PUBLISH_HANDOFF_DESCRIPTION as g, PUBLISH_HANDOFF_CONTENT_DESCRIPTION as h, runAgent as i, mergeEnvValues as j, fetchSkillMenu as k, recoverOrphanedSettingsBackups as l, createSecretVault as m, buildRunTags as n, backupAndFixClaudeSettings as o, assembleCommandments as p, initializeAgent as r, checkAllSettingsConflicts as s, buildAgentEnv as t, restoreClaudeSettings as u, publishHandoff as v, WIZARD_ASK_TOOL_DESCRIPTION as w, ENV_FILE_PATH_DESCRIPTION as x, CHECK_ENV_KEYS_DESCRIPTION as y, MAX_ENV_KEY_SET as z };
|
|
3487
3576
|
|
|
3488
|
-
//# sourceMappingURL=agent-interface-
|
|
3577
|
+
//# sourceMappingURL=agent-interface-tM_b0l__.js.map
|