@posthog/wizard 2.82.0 → 2.83.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/{agent-interface-3YfIWZmY.js → agent-interface-fcDXqb-_.js} +84 -30
- package/dist/agent-interface-fcDXqb-_.js.map +1 -0
- package/dist/{agent-prompt-loader-hOHONY7u.js → agent-prompt-loader-F9gGPMt0.js} +6 -6
- package/dist/{agent-prompt-loader-hOHONY7u.js.map → agent-prompt-loader-F9gGPMt0.js.map} +1 -1
- package/dist/analytics-C9QnGvuc.js +2 -0
- package/dist/{analytics-B_xFshPY.js → analytics-GQv--mQm.js} +4 -3
- package/dist/analytics-GQv--mQm.js.map +1 -0
- package/dist/api-CsXfZKkq.js +2 -0
- package/dist/{api-C_9KsN-7.js → api-WUOSLXPJ.js} +2 -2
- package/dist/{api-C_9KsN-7.js.map → api-WUOSLXPJ.js.map} +1 -1
- package/dist/api-key-login-CDSxsYtP.js +2 -0
- package/dist/{api-key-login-oUJQDmOV.js → api-key-login-tysMeZnR.js} +5 -5
- package/dist/{api-key-login-oUJQDmOV.js.map → api-key-login-tysMeZnR.js.map} +1 -1
- package/dist/bin.js +1 -1
- package/dist/{bounded-fs-iRaQcKYL.js → bounded-fs-B31zq2ir.js} +3 -3
- package/dist/{bounded-fs-iRaQcKYL.js.map → bounded-fs-B31zq2ir.js.map} +1 -1
- package/dist/{ci-install-BGlijoTo.js → ci-install-CYSFbFXd.js} +4 -4
- package/dist/{ci-install-BGlijoTo.js.map → ci-install-CYSFbFXd.js.map} +1 -1
- package/dist/{debug-BvEbemym.js → debug-BTUMatFI.js} +3 -3
- package/dist/{debug-BvEbemym.js.map → debug-BTUMatFI.js.map} +1 -1
- package/dist/{gateway-CWoYlPz7.js → gateway-CJ8Jqbll.js} +20 -6
- package/dist/{gateway-CWoYlPz7.js.map → gateway-CJ8Jqbll.js.map} +1 -1
- package/dist/{headless-Gisv3faN.js → headless-DZ3mq07K.js} +1 -1
- package/dist/{headless-Bfi950Qh.js → headless-le-QqOuj.js} +2 -2
- package/dist/{headless-Bfi950Qh.js.map → headless-le-QqOuj.js.map} +1 -1
- package/dist/{host-resolution-BxnNn8Jm.js → host-resolution-Cht8bL39.js} +4 -4
- package/dist/{host-resolution-BxnNn8Jm.js.map → host-resolution-Cht8bL39.js.map} +1 -1
- package/dist/{install-CX65IxGa.js → install-55JbRsO-.js} +1 -1
- package/dist/{install-CDVeUT_5.js → install-BhnFP3p3.js} +5 -5
- package/dist/{install-CDVeUT_5.js.map → install-BhnFP3p3.js.map} +1 -1
- package/dist/{interactive-5-Numwwb.js → interactive-9qRL8259.js} +3 -3
- package/dist/{interactive-5-Numwwb.js.map → interactive-9qRL8259.js.map} +1 -1
- package/dist/{links-Dmj3Wj9X.js → links-5Blqk4Im.js} +3 -3
- package/dist/{links-Dmj3Wj9X.js.map → links-5Blqk4Im.js.map} +1 -1
- package/dist/{main-5KNn80Vt.js → main-CUIcozEG.js} +24 -21
- package/dist/main-CUIcozEG.js.map +1 -0
- package/dist/{mcp-Buf9sfFm.js → mcp-D73aCOHK.js} +3 -3
- package/dist/{mcp-Buf9sfFm.js.map → mcp-D73aCOHK.js.map} +1 -1
- package/dist/{mcp-prompt-streaming-DHPxJK-F.js → mcp-prompt-streaming-B5lIQ0l1.js} +5 -5
- package/dist/{mcp-prompt-streaming-DHPxJK-F.js.map → mcp-prompt-streaming-B5lIQ0l1.js.map} +1 -1
- package/dist/{models-C9rjXPZ6.js → models-CLTglHFZ.js} +6 -2
- package/dist/models-CLTglHFZ.js.map +1 -0
- package/dist/{oauth-session-Bi1MLRCC.js → oauth-session-CfkZ339p.js} +2 -2
- package/dist/{oauth-session-Bi1MLRCC.js.map → oauth-session-CfkZ339p.js.map} +1 -1
- package/dist/{orchestrator-tools-DyKws92o.js → orchestrator-tools-lvNVQhzs.js} +3 -3
- package/dist/{orchestrator-tools-DyKws92o.js.map → orchestrator-tools-lvNVQhzs.js.map} +1 -1
- package/dist/{package-manager-DpCdmMmB.js → package-manager-BqRNp5y_.js} +4 -4
- package/dist/{package-manager-DpCdmMmB.js.map → package-manager-BqRNp5y_.js.map} +1 -1
- package/dist/{pi-DTj1hsJe.js → pi-2pYz2OY3.js} +43 -23
- package/dist/pi-2pYz2OY3.js.map +1 -0
- package/dist/{playground-CiH6zZPb.js → playground-jxZNxRwC.js} +4 -4
- package/dist/{playground-CiH6zZPb.js.map → playground-jxZNxRwC.js.map} +1 -1
- package/dist/{posthog-integration-CpinLWNO.js → posthog-integration-DxRkw5DI.js} +21 -21
- package/dist/{posthog-integration-CpinLWNO.js.map → posthog-integration-DxRkw5DI.js.map} +1 -1
- package/dist/programs-D2793-PK.js +3 -0
- package/dist/{programs-Bq9Ju9xk.js → programs-eTv2T2rs.js} +129 -54
- package/dist/programs-eTv2T2rs.js.map +1 -0
- package/dist/provisioning-CtQ0GEHa.js +2 -0
- package/dist/{provisioning-D-AM_7DG.js → provisioning-c5JJ30KX.js} +4 -4
- package/dist/{provisioning-D-AM_7DG.js.map → provisioning-c5JJ30KX.js.map} +1 -1
- package/dist/{queue-tools-BoIITT7w.js → queue-tools-10w8lhEs.js} +14 -5
- package/dist/queue-tools-10w8lhEs.js.map +1 -0
- package/dist/{results-CDqlHogZ.js → results-C45prSKD.js} +2 -2
- package/dist/{results-CDqlHogZ.js.map → results-C45prSKD.js.map} +1 -1
- package/dist/{run-DcaVJSeI.js → run-CM24OgPF.js} +10 -10
- package/dist/{run-DcaVJSeI.js.map → run-CM24OgPF.js.map} +1 -1
- package/dist/{run-CfMArkpV.js → run-jugssomh.js} +7 -7
- package/dist/{run-CfMArkpV.js.map → run-jugssomh.js.map} +1 -1
- package/dist/run-tool-BZFgFb_2.js +2 -0
- package/dist/{run-tool-DJZWnnR9.js → run-tool-DZrZFoGq.js} +13 -13
- package/dist/{run-tool-DJZWnnR9.js.map → run-tool-DZrZFoGq.js.map} +1 -1
- package/dist/{runners-Cvnk9BcA.js → runners-CoIYt0iI.js} +8 -8
- package/dist/{runners-Cvnk9BcA.js.map → runners-CoIYt0iI.js.map} +1 -1
- package/dist/{security-Cz3a-d7r.js → security-ppK2MwCn.js} +6 -5
- package/dist/{security-Cz3a-d7r.js.map → security-ppK2MwCn.js.map} +1 -1
- package/dist/{setup-utils-C7kaDP5X.js → setup-utils-B5E1rXLa.js} +3 -3
- package/dist/{setup-utils-C7kaDP5X.js.map → setup-utils-B5E1rXLa.js.map} +1 -1
- package/dist/{start-playground-B62_pYfu.js → start-playground-DujiUNFT.js} +7 -7
- package/dist/{start-playground-B62_pYfu.js.map → start-playground-DujiUNFT.js.map} +1 -1
- package/dist/{subagent-BBfETG17.js → subagent-BdDWA8j5.js} +12 -4
- package/dist/subagent-BdDWA8j5.js.map +1 -0
- package/dist/{task-CmNe3xeg.js → task-Y8lWoDE7.js} +34 -23
- package/dist/task-Y8lWoDE7.js.map +1 -0
- package/dist/{telemetry-DKM7VGuJ.js → telemetry-Cwqf0iur.js} +2 -2
- package/dist/{telemetry-DKM7VGuJ.js.map → telemetry-Cwqf0iur.js.map} +1 -1
- package/dist/{terminal-Bkxwzkhn.js → terminal-BLL-X6YP.js} +397 -36
- package/dist/terminal-BLL-X6YP.js.map +1 -0
- package/dist/{tools-DZCEvDv9.js → tools-C8k90ISV.js} +13 -13
- package/dist/{tools-DZCEvDv9.js.map → tools-C8k90ISV.js.map} +1 -1
- package/dist/{tools-Bm0FDT6f.js → tools-g42e5kJz.js} +8 -8
- package/dist/{tools-Bm0FDT6f.js.map → tools-g42e5kJz.js.map} +1 -1
- package/dist/{tui-tKI95MSr.js → tui-BPWJ-J-k.js} +1 -1
- package/dist/{tui-B56jvkbi.js → tui-CBnRWnrm.js} +4 -4
- package/dist/tui-CBnRWnrm.js.map +1 -0
- package/dist/{upload-step-DqTgn6UB.js → upload-step-CFoxwd5t.js} +3 -3
- package/dist/{upload-step-DqTgn6UB.js.map → upload-step-CFoxwd5t.js.map} +1 -1
- package/dist/{urls-B82v7gfO.js → urls-BTZhm5eA.js} +2 -2
- package/dist/{urls-B82v7gfO.js.map → urls-BTZhm5eA.js.map} +1 -1
- package/dist/{wizard-abort-Cd-7sfCw.js → wizard-abort-HtpiSsQO.js} +4 -4
- package/dist/{wizard-abort-Cd-7sfCw.js.map → wizard-abort-HtpiSsQO.js.map} +1 -1
- package/dist/{yara-hooks-BS0n3ekf.js → yara-hooks-BPYhN9WM.js} +4 -4
- package/dist/{yara-hooks-BS0n3ekf.js.map → yara-hooks-BPYhN9WM.js.map} +1 -1
- package/dist/{yara-hooks-CxksH-GZ.js → yara-hooks-BwhEDXIt.js} +1 -1
- package/package.json +1 -1
- package/dist/agent-interface-3YfIWZmY.js.map +0 -1
- package/dist/analytics-B_xFshPY.js.map +0 -1
- package/dist/analytics-DGDr6-iD.js +0 -2
- package/dist/api-DhLSO3ai.js +0 -2
- package/dist/api-key-login-DiRuZ8Lm.js +0 -2
- package/dist/main-5KNn80Vt.js.map +0 -1
- package/dist/models-C9rjXPZ6.js.map +0 -1
- package/dist/pi-DTj1hsJe.js.map +0 -1
- package/dist/programs-Bq9Ju9xk.js.map +0 -1
- package/dist/programs-CnOSdQo1.js +0 -3
- package/dist/provisioning-D6Cqbc36.js +0 -2
- package/dist/queue-tools-BoIITT7w.js.map +0 -1
- package/dist/run-tool-zMLQroVh.js +0 -2
- package/dist/subagent-BBfETG17.js.map +0 -1
- package/dist/task-CmNe3xeg.js.map +0 -1
- package/dist/terminal-Bkxwzkhn.js.map +0 -1
- package/dist/tui-B56jvkbi.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as initLogFile, i as getLogFilePath, o as logToFile, r as formatLogLine, v as runtimeEnv } from "./debug-
|
|
2
|
-
import {
|
|
1
|
+
import { a as initLogFile, i as getLogFilePath, o as logToFile, r as formatLogLine, v as runtimeEnv } from "./debug-BTUMatFI.js";
|
|
2
|
+
import { at as wizardUserAgentForProgram, et as WIZARD_REMARK_EVENT_NAME, l as AWS_SKILLS_BASE_URL, n as analytics } from "./analytics-GQv--mQm.js";
|
|
3
3
|
import { i as classifyAuthFailure } from "./errors-DhFeR8Sp.js";
|
|
4
|
-
import { a as safeReadFile, i as readProjectFile, o as walkProjectFiles } from "./bounded-fs-
|
|
5
|
-
import { c as isGrantRevoked, i as oauthCredentials, s as rotateAfterUnauthorized } from "./oauth-session-
|
|
6
|
-
import { c as REMARK_INSTRUCTION, d as
|
|
7
|
-
import { i as modelCapabilities, o as triageModelFor } from "./models-
|
|
8
|
-
import {
|
|
9
|
-
import { C as coerceAuditChecks, _ as downloadSkill, l as prewarmYaraScanner, n as createPostToolUseYaraHooks, p as scanInstalledSkill, r as createPreToolUseYaraHooks, x as AUDIT_CHECKS_FILE, y as fetchSkillMenu } from "./yara-hooks-
|
|
10
|
-
import { a as createMarkdownNotebook, f as updateMarkdownNotebook, s as fetchMarkdownNotebook } from "./api-
|
|
4
|
+
import { a as safeReadFile, i as readProjectFile, o as walkProjectFiles } from "./bounded-fs-B31zq2ir.js";
|
|
5
|
+
import { c as isGrantRevoked, i as oauthCredentials, s as rotateAfterUnauthorized } from "./oauth-session-CfkZ339p.js";
|
|
6
|
+
import { c as REMARK_INSTRUCTION, d as buildWizardPropertiesBlob, f as gatewayAuth, i as gatewayApiFor, l as RESUME_INSTRUCTION, n as buildGatewayModel, p as isPastRefresh, s as AgentSignals, u as policyAbortReason } from "./gateway-CJ8Jqbll.js";
|
|
7
|
+
import { i as modelCapabilities, o as triageModelFor } from "./models-CLTglHFZ.js";
|
|
8
|
+
import { d as taskReported, l as buildOrchestratorTools, v as makeMutex, y as writeJsonAtomic } from "./queue-tools-10w8lhEs.js";
|
|
9
|
+
import { C as coerceAuditChecks, _ as downloadSkill, l as prewarmYaraScanner, n as createPostToolUseYaraHooks, p as scanInstalledSkill, r as createPreToolUseYaraHooks, x as AUDIT_CHECKS_FILE, y as fetchSkillMenu } from "./yara-hooks-BPYhN9WM.js";
|
|
10
|
+
import { a as createMarkdownNotebook, f as updateMarkdownNotebook, s as fetchMarkdownNotebook } from "./api-WUOSLXPJ.js";
|
|
11
11
|
import { createRequire } from "node:module";
|
|
12
|
-
import * as fs$
|
|
12
|
+
import * as fs$2 from "fs";
|
|
13
13
|
import fs from "fs";
|
|
14
14
|
import path from "path";
|
|
15
15
|
import path$1 from "node:path";
|
|
@@ -18,6 +18,7 @@ import { closeSync, constants, fchmodSync, lstatSync, openSync, renameSync, unli
|
|
|
18
18
|
import axios from "axios";
|
|
19
19
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
20
20
|
import * as os from "os";
|
|
21
|
+
import { readFile } from "fs/promises";
|
|
21
22
|
import { minimatch } from "minimatch";
|
|
22
23
|
import { randomUUID as randomUUID$1 } from "crypto";
|
|
23
24
|
import { z } from "zod";
|
|
@@ -65,6 +66,11 @@ function createTriageLLMProvider(auth, harness) {
|
|
|
65
66
|
});
|
|
66
67
|
const text = message.content.filter((c) => c.type === "text").map((c) => c.text).join("");
|
|
67
68
|
if (message.stopReason === "error") logToFile(`[YARA] triage call failed on ${model.id}: ${message.errorMessage ?? "unknown"} — every flagged match will be acted on`);
|
|
69
|
+
const refusal = policyAbortReason(text);
|
|
70
|
+
if (refusal) {
|
|
71
|
+
logToFile(`[YARA] gateway policy refused the triage call: ${refusal}`);
|
|
72
|
+
throw new Error("AI gateway refused the triage call");
|
|
73
|
+
}
|
|
68
74
|
return text;
|
|
69
75
|
} finally {
|
|
70
76
|
clearTimeout(timer);
|
|
@@ -2709,7 +2715,7 @@ const BLOCKING_SETTINGS_KEYS = ["apiKeyHelper"];
|
|
|
2709
2715
|
*/
|
|
2710
2716
|
function checkSettingsFile(filePath) {
|
|
2711
2717
|
try {
|
|
2712
|
-
const raw = fs$
|
|
2718
|
+
const raw = fs$2.readFileSync(filePath, "utf-8");
|
|
2713
2719
|
const parsed = JSON.parse(raw);
|
|
2714
2720
|
const matched = [];
|
|
2715
2721
|
const envBlock = parsed?.env;
|
|
@@ -2810,10 +2816,10 @@ function ensureBackupGitignored(claudeDir) {
|
|
|
2810
2816
|
const gitignorePath = path.join(claudeDir, ".gitignore");
|
|
2811
2817
|
const entry = `*${BACKUP_SUFFIX}`;
|
|
2812
2818
|
try {
|
|
2813
|
-
const existing = fs$
|
|
2819
|
+
const existing = fs$2.existsSync(gitignorePath) ? fs$2.readFileSync(gitignorePath, "utf-8") : "";
|
|
2814
2820
|
if (existing.split("\n").map((l) => l.trim()).includes(entry)) return;
|
|
2815
2821
|
const sep = existing && !existing.endsWith("\n") ? "\n" : "";
|
|
2816
|
-
fs$
|
|
2822
|
+
fs$2.writeFileSync(gitignorePath, `${existing}${sep}${entry}\n`);
|
|
2817
2823
|
} catch (error) {
|
|
2818
2824
|
analytics.captureException(error);
|
|
2819
2825
|
}
|
|
@@ -2825,15 +2831,15 @@ function ensureBackupGitignored(claudeDir) {
|
|
|
2825
2831
|
*/
|
|
2826
2832
|
function backupAndFixClaudeSettings(workingDirectory) {
|
|
2827
2833
|
for (const { claudeDir, original, backup } of settingsBackupTargets(workingDirectory)) {
|
|
2828
|
-
if (!fs$
|
|
2834
|
+
if (!fs$2.existsSync(original)) continue;
|
|
2829
2835
|
try {
|
|
2830
|
-
if (!fs$
|
|
2831
|
-
fs$
|
|
2832
|
-
const mode = fs$
|
|
2833
|
-
fs$
|
|
2836
|
+
if (!fs$2.existsSync(backup)) {
|
|
2837
|
+
fs$2.copyFileSync(original, backup);
|
|
2838
|
+
const mode = fs$2.statSync(original).mode & 511;
|
|
2839
|
+
fs$2.chmodSync(backup, mode);
|
|
2834
2840
|
}
|
|
2835
2841
|
ensureBackupGitignored(claudeDir);
|
|
2836
|
-
fs$
|
|
2842
|
+
fs$2.unlinkSync(original);
|
|
2837
2843
|
analytics.wizardCapture("backedup-claude-settings");
|
|
2838
2844
|
registerCleanup(() => {
|
|
2839
2845
|
try {
|
|
@@ -2860,10 +2866,10 @@ function backupAndFixClaudeSettings(workingDirectory) {
|
|
|
2860
2866
|
*/
|
|
2861
2867
|
function restoreClaudeSettings(workingDirectory) {
|
|
2862
2868
|
for (const { original, backup } of settingsBackupTargets(workingDirectory)) {
|
|
2863
|
-
if (!fs$
|
|
2869
|
+
if (!fs$2.existsSync(backup)) continue;
|
|
2864
2870
|
try {
|
|
2865
|
-
fs$
|
|
2866
|
-
fs$
|
|
2871
|
+
fs$2.copyFileSync(backup, original);
|
|
2872
|
+
fs$2.rmSync(backup, { force: true });
|
|
2867
2873
|
analytics.wizardCapture("restored-claude-settings");
|
|
2868
2874
|
return;
|
|
2869
2875
|
} catch (error) {
|
|
@@ -2887,10 +2893,10 @@ function restoreClaudeSettings(workingDirectory) {
|
|
|
2887
2893
|
*/
|
|
2888
2894
|
function recoverOrphanedSettingsBackups(workingDirectory) {
|
|
2889
2895
|
for (const { original, backup } of settingsBackupTargets(workingDirectory)) {
|
|
2890
|
-
if (!fs$
|
|
2896
|
+
if (!fs$2.existsSync(backup) || fs$2.existsSync(original)) continue;
|
|
2891
2897
|
try {
|
|
2892
|
-
fs$
|
|
2893
|
-
fs$
|
|
2898
|
+
fs$2.copyFileSync(backup, original);
|
|
2899
|
+
fs$2.rmSync(backup, { force: true });
|
|
2894
2900
|
analytics.wizardCapture("recovered-orphaned-settings");
|
|
2895
2901
|
} catch (error) {
|
|
2896
2902
|
analytics.captureException(error);
|
|
@@ -2943,7 +2949,7 @@ const claudeConfigDir = (homeDir = os.homedir()) => process.env.CLAUDE_CONFIG_DI
|
|
|
2943
2949
|
*/
|
|
2944
2950
|
function createIsolatedAgentConfigDir() {
|
|
2945
2951
|
const base = process.platform === "win32" ? os.tmpdir() : "/tmp";
|
|
2946
|
-
return fs$
|
|
2952
|
+
return fs$2.mkdtempSync(path.join(base, "posthog-wizard-claude-"));
|
|
2947
2953
|
}
|
|
2948
2954
|
/**
|
|
2949
2955
|
* Look for a stored Claude login. `homeDir` / `platform` are injectable for
|
|
@@ -2953,7 +2959,7 @@ function detectStoredClaudeLogin(homeDir = os.homedir(), platform = process.plat
|
|
|
2953
2959
|
const credentialsPath = path.join(claudeConfigDir(homeDir), ".credentials.json");
|
|
2954
2960
|
let credentialsFile = false;
|
|
2955
2961
|
try {
|
|
2956
|
-
credentialsFile = fs$
|
|
2962
|
+
credentialsFile = fs$2.existsSync(credentialsPath);
|
|
2957
2963
|
} catch (error) {
|
|
2958
2964
|
logToFile(`[stored-login] checked ${credentialsPath} — unreadable (${error instanceof Error ? error.message : String(error)}), treating as absent`);
|
|
2959
2965
|
analytics.wizardCapture("stored login check failed", { step: "credentials-file" });
|
|
@@ -3033,7 +3039,7 @@ function buildAuthErrorContext(workingDirectory, gatewayUrl, homeDir = os.homedi
|
|
|
3033
3039
|
* Phase 1 — collect remark (once): block with remark prompt
|
|
3034
3040
|
* Phase 2 — allow stop: return {}
|
|
3035
3041
|
*/
|
|
3036
|
-
function createStopHook(signals, requestRemark = true) {
|
|
3042
|
+
function createStopHook(signals, requestRemark = true, onRemark) {
|
|
3037
3043
|
let remarkRequested = false;
|
|
3038
3044
|
return (input) => {
|
|
3039
3045
|
logToFile("Stop hook triggered", {
|
|
@@ -3046,6 +3052,7 @@ function createStopHook(signals, requestRemark = true) {
|
|
|
3046
3052
|
}
|
|
3047
3053
|
if (requestRemark && !remarkRequested) {
|
|
3048
3054
|
remarkRequested = true;
|
|
3055
|
+
onRemark?.(input.last_assistant_message);
|
|
3049
3056
|
logToFile("Stop hook: requesting reflection");
|
|
3050
3057
|
return {
|
|
3051
3058
|
decision: "block",
|
|
@@ -3269,6 +3276,7 @@ async function initializeAgent(config, options) {
|
|
|
3269
3276
|
handoffNotebook: config.handoffNotebook
|
|
3270
3277
|
});
|
|
3271
3278
|
const model = config.modelOverride ?? "claude-sonnet-5";
|
|
3279
|
+
const queue = config.orchestrator;
|
|
3272
3280
|
const agentRunConfig = {
|
|
3273
3281
|
workingDirectory: config.workingDirectory,
|
|
3274
3282
|
mcpServers,
|
|
@@ -3283,6 +3291,7 @@ async function initializeAgent(config, options) {
|
|
|
3283
3291
|
disallowedTools: config.disallowedTools,
|
|
3284
3292
|
getPendingQuestion: config.getPendingQuestion,
|
|
3285
3293
|
suppressTaskRender: !!config.orchestrator,
|
|
3294
|
+
taskReported: queue && (() => taskReported(queue)),
|
|
3286
3295
|
capture: config.capture,
|
|
3287
3296
|
triageProvider,
|
|
3288
3297
|
gatewayAuth: auth,
|
|
@@ -3437,6 +3446,18 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
|
|
|
3437
3446
|
};
|
|
3438
3447
|
let timedOut = false;
|
|
3439
3448
|
let abortReason = null;
|
|
3449
|
+
let policyAborted = false;
|
|
3450
|
+
const subagentCallIds = /* @__PURE__ */ new Set();
|
|
3451
|
+
let remarkTurn = false;
|
|
3452
|
+
const policyAbort = (reply) => {
|
|
3453
|
+
const reason = typeof reply === "string" ? policyAbortReason(reply) : void 0;
|
|
3454
|
+
if (!reason || abortReason || remarkTurn || agentConfig.taskReported?.()) return;
|
|
3455
|
+
abortReason = reason;
|
|
3456
|
+
policyAborted = true;
|
|
3457
|
+
logToFile(`Agent emitted [posthog:abort]: ${reason}`);
|
|
3458
|
+
abortController.abort();
|
|
3459
|
+
signalDone();
|
|
3460
|
+
};
|
|
3440
3461
|
let yaraViolationReason = null;
|
|
3441
3462
|
let sessionId;
|
|
3442
3463
|
let reminted = false;
|
|
@@ -3540,6 +3561,7 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
|
|
|
3540
3561
|
CLAUDE_CODE_OAUTH_TOKEN: agentConfig.gatewayAuth.token,
|
|
3541
3562
|
CLAUDE_CONFIG_DIR: agentConfigDir,
|
|
3542
3563
|
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: "true",
|
|
3564
|
+
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS: "1",
|
|
3543
3565
|
POSTHOG_MCP_TOKEN: await agentConfig.currentPosthogApiKey?.() ?? agentConfig.posthogApiKey,
|
|
3544
3566
|
MCP_CONNECTION_NONBLOCKING: "0",
|
|
3545
3567
|
ANTHROPIC_CUSTOM_HEADERS: buildAgentEnv(agentConfig.wizardMetadata ?? {}, agentConfig.wizardFlags ?? {}, agentConfig.gatewayAuth.teamId)
|
|
@@ -3579,7 +3601,17 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
|
|
|
3579
3601
|
PreToolUse: warlockDisabled ? [] : createPreToolUseYaraHooks(triageProvider, onYaraTerminate),
|
|
3580
3602
|
PostToolUse: warlockDisabled ? [] : createPostToolUseYaraHooks(triageProvider, onYaraTerminate),
|
|
3581
3603
|
Stop: [{
|
|
3582
|
-
hooks: [createStopHook(signals, config?.requestRemark ?? true)
|
|
3604
|
+
hooks: [createStopHook(signals, config?.requestRemark ?? true, (lastReply) => {
|
|
3605
|
+
policyAbort(lastReply);
|
|
3606
|
+
remarkTurn = true;
|
|
3607
|
+
})],
|
|
3608
|
+
timeout: 30
|
|
3609
|
+
}],
|
|
3610
|
+
SubagentStop: [{
|
|
3611
|
+
hooks: [async (input) => {
|
|
3612
|
+
policyAbort(await transcriptRefusal(input.agent_transcript_path));
|
|
3613
|
+
return {};
|
|
3614
|
+
}],
|
|
3583
3615
|
timeout: 30
|
|
3584
3616
|
}]
|
|
3585
3617
|
}
|
|
@@ -3623,6 +3655,10 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
|
|
|
3623
3655
|
}
|
|
3624
3656
|
}
|
|
3625
3657
|
}
|
|
3658
|
+
const blocks = message.message?.content;
|
|
3659
|
+
for (const block of Array.isArray(blocks) ? blocks : []) if (block.type === "tool_use" && block.name === "Agent") subagentCallIds.add(block.id);
|
|
3660
|
+
else if (message.type === "assistant" && block.type === "text") policyAbort(block.text);
|
|
3661
|
+
else if (message.type === "user" && block.type === "tool_result" && subagentCallIds.has(block.tool_use_id)) policyAbort(contentText(block.content));
|
|
3626
3662
|
if (message.type === "assistant" && sdkErrorStatus(message.error) === 401 || message.type === "result" && (sdkErrorStatus(message.api_error_status) === 401 || sdkErrorStatus(message.status) === 401) || message.type === "result" && Array.isArray(message.errors) && message.errors.some((error) => sdkErrorStatus(error) === 401)) {
|
|
3627
3663
|
signalDone();
|
|
3628
3664
|
if (agentConfig.refreshGatewayAuth && !reminted && isPastRefresh(agentConfig.gatewayAuth) && !agentConfig.signal?.aborted) {
|
|
@@ -3886,6 +3922,7 @@ async function runAgent(agentConfig, prompt, options, spinner, config, middlewar
|
|
|
3886
3922
|
duration_ms: durationMs,
|
|
3887
3923
|
duration_seconds: Math.round(durationMs / 1e3),
|
|
3888
3924
|
model: agentConfig.model,
|
|
3925
|
+
...policyAborted ? { source: "gateway_policy" } : {},
|
|
3889
3926
|
...config?.analyticsProperties
|
|
3890
3927
|
});
|
|
3891
3928
|
} catch {}
|
|
@@ -4012,6 +4049,23 @@ function extractTaskIdFromToolResult(result) {
|
|
|
4012
4049
|
if (typeof obj.taskId === "string") return obj.taskId;
|
|
4013
4050
|
if (typeof obj.id === "string") return obj.id;
|
|
4014
4051
|
}
|
|
4052
|
+
/** A message's or tool_result's text, whether its content is a string or blocks. */
|
|
4053
|
+
function contentText(content) {
|
|
4054
|
+
if (!Array.isArray(content)) return typeof content === "string" ? content : "";
|
|
4055
|
+
return content.map((b) => b.text ?? "").join("\n");
|
|
4056
|
+
}
|
|
4057
|
+
/** The first assistant reply in a subagent transcript that starts with the policy abort marker. */
|
|
4058
|
+
async function transcriptRefusal(transcriptPath) {
|
|
4059
|
+
const raw = transcriptPath ? await readFile(transcriptPath, "utf8").catch(() => "") : "";
|
|
4060
|
+
for (const line of raw.split("\n")) {
|
|
4061
|
+
if (!line.includes(AgentSignals.POLICY_ABORT)) continue;
|
|
4062
|
+
try {
|
|
4063
|
+
const entry = JSON.parse(line);
|
|
4064
|
+
const text = contentText(entry.message?.content);
|
|
4065
|
+
if (entry.type === "assistant" && policyAbortReason(text)) return text;
|
|
4066
|
+
} catch {}
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4015
4069
|
/**
|
|
4016
4070
|
* Fallback id extractor for the inner tool_result block.content — used only
|
|
4017
4071
|
* when message.tool_use_result is absent. In current SDK versions the inner
|
|
@@ -4219,4 +4273,4 @@ function handleSDKMessage(message, options, spinner, signals, emit, receivedSucc
|
|
|
4219
4273
|
//#endregion
|
|
4220
4274
|
export { vaultSensitiveAnswers as $, AUDIT_STATUSES as A, checkEnvKeys as B, readNeedsAttention as C, AUDIT_RESOLVE_CHECKS_PARAM_DESCRIPTION as D, AUDIT_RESOLVE_CHECKS_DESCRIPTION as E, WIZARD_ASK_SENSITIVE_DESCRIPTION as F, mergeEnvValues as G, describeAskCancellation as H, WIZARD_ASK_SUBJECT_DESCRIPTION as I, resolveAuditChecks as J, normaliseAskSubject as K, WIZARD_ASK_TOOL_DESCRIPTION as L, CHECK_ENV_KEYS_FILE_PATH_DESCRIPTION as M, ENV_FILE_PATH_DESCRIPTION as N, AUDIT_SEED_CHECKS_DESCRIPTION as O, WIZARD_ASK_KIND_DESCRIPTION as P, templateEnvWriteRefusal as Q, WIZARD_TOOL_NAMES as R, NEEDS_ATTENTION_HEADING as S, AUDIT_ADD_CHECKS_PARAM_DESCRIPTION as T, ensureGitignoreCoverage as U, createAskAccounting 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, createTriageLLMProvider as ct, restoreClaudeSettings as d, createWizardAskBridge as et, sanitizeAgentSubprocessEnv as f, assembleCommandments as g, AgentOutputSignals as h, runAgent as i, MAX_ENV_KEY_SET as it, CHECK_ENV_KEYS_DESCRIPTION as j, AUDIT_SEED_CHECKS_PARAM_DESCRIPTION as k, classifySettingsConflicts as l, runCleanups as m, buildRunTags as n, LONGER_ASK_TIMEOUT_MS as nt, createIsolatedAgentConfigDir as o, parseEnvKeyNames as ot, registerCleanup as p, resolveAskQuestionKinds as q, initializeAgent as r, shouldDisableAsk as rt, backupAndFixClaudeSettings as s, toPromptSafeRelativePath as st, buildAgentEnv as t, isFullyCancelled as tt, recoverOrphanedSettingsBackups as u, PUBLISH_HANDOFF_CONTENT_DESCRIPTION as v, AUDIT_ADD_CHECKS_DESCRIPTION as w, publishHandoff as x, PUBLISH_HANDOFF_DESCRIPTION as y, addAuditChecks as z };
|
|
4221
4275
|
|
|
4222
|
-
//# sourceMappingURL=agent-interface-
|
|
4276
|
+
//# sourceMappingURL=agent-interface-fcDXqb-_.js.map
|