@pushary/agent-hooks 1.9.56 → 1.9.58
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/CHANGELOG.md +19 -0
- package/dist/{api-JHBUZ7CV.js → api-WVXBM4MR.js} +10 -10
- package/dist/bin/pushary-bell-hook.js +27 -27
- package/dist/bin/pushary-bell.js +10 -10
- package/dist/bin/pushary-claude.js +26 -26
- package/dist/bin/pushary-clean.js +49 -46
- package/dist/bin/pushary-codex-bridge.js +21 -21
- package/dist/bin/pushary-codex-hook.js +32 -32
- package/dist/bin/pushary-codex-session.js +10 -8
- package/dist/bin/pushary-codex.js +14 -14
- package/dist/bin/pushary-connect.js +27 -26
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +37 -37
- package/dist/bin/pushary-disconnect.js +26 -26
- package/dist/bin/pushary-doctor.js +41 -39
- package/dist/bin/pushary-elicitation-hook.js +27 -27
- package/dist/bin/pushary-gemini-bridge.js +15 -15
- package/dist/bin/pushary-gemini-hook.js +29 -29
- package/dist/bin/pushary-hook.js +31 -31
- package/dist/bin/pushary-login.js +13 -13
- package/dist/bin/pushary-logout.js +26 -26
- package/dist/bin/pushary-mcp.js +11 -11
- package/dist/bin/pushary-mode.js +13 -13
- package/dist/bin/pushary-notification-hook.js +26 -26
- package/dist/bin/pushary-opencode-hook.js +28 -28
- package/dist/bin/pushary-permission-denied-hook.js +31 -31
- package/dist/bin/pushary-permission-hook.js +30 -30
- package/dist/bin/pushary-post-hook.js +26 -26
- package/dist/bin/pushary-prompt-hook.js +26 -26
- package/dist/bin/pushary-session-end-hook.js +26 -26
- package/dist/bin/pushary-session-start-hook.js +33 -33
- package/dist/bin/pushary-setup.js +65 -268
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +32 -30
- package/dist/bin/pushary-stop-hook.js +26 -26
- package/dist/bin/pushary-stopfailure-hook.js +26 -26
- package/dist/bin/pushary-suggestions.js +13 -13
- package/dist/bin/pushary-transcript-register.js +18 -18
- package/dist/bin/pushary-transcripts.js +7 -7
- package/dist/bin/pushary-upgrade.js +107 -58
- package/dist/bin/pushary-wait.js +13 -13
- package/dist/bin/pushary.js +7 -7
- package/dist/{chunk-DWV3LTUH.js → chunk-3KOPY2UQ.js} +3 -3
- package/dist/{chunk-X5FHQMUL.js → chunk-3TJLPABQ.js} +3 -3
- package/dist/{chunk-OCYOOGXW.js → chunk-3WNOO7BM.js} +4 -4
- package/dist/{chunk-FJ7ZMR4N.js → chunk-4JJ3T7IE.js} +94 -15
- package/dist/{chunk-LTCNAIY2.js → chunk-4LUPZ347.js} +2 -2
- package/dist/{chunk-V2AMLVMD.js → chunk-4YNNAF53.js} +2 -2
- package/dist/{chunk-32MSOGMD.js → chunk-5DZHKNBU.js} +3 -3
- package/dist/{chunk-T4IAMIX4.js → chunk-5SFM6XB4.js} +1 -1
- package/dist/{chunk-WW266XKU.js → chunk-7RZO6VWD.js} +2 -2
- package/dist/{chunk-VZ3YPEMG.js → chunk-ATUZX4K7.js} +3 -3
- package/dist/{chunk-4US3BCQJ.js → chunk-C3IWX6KU.js} +1 -1
- package/dist/{chunk-AKFTQT7P.js → chunk-CK5BCFQF.js} +2 -2
- package/dist/{chunk-ILQARYXK.js → chunk-CSQJCXPX.js} +5 -5
- package/dist/chunk-CZULJ647.js +378 -0
- package/dist/{chunk-J5HQNZXQ.js → chunk-DQ565WFA.js} +5 -5
- package/dist/{chunk-ZMRO6ESW.js → chunk-ECJJKDP7.js} +1 -1
- package/dist/chunk-FAGDOPQI.js +266 -0
- package/dist/{chunk-WACFIQYA.js → chunk-GZL3KEPC.js} +51 -25
- package/dist/{chunk-MVW5WS6F.js → chunk-HRHAZ3GE.js} +36 -28
- package/dist/{chunk-GWQ6T6JV.js → chunk-HUWLEVL2.js} +5 -5
- package/dist/{chunk-5HMYW5W2.js → chunk-I43PY5G3.js} +1 -1
- package/dist/{chunk-SMMDQXI2.js → chunk-IJ6XKKQW.js} +1 -1
- package/dist/{chunk-YBE2KH2U.js → chunk-IRZ5FVWG.js} +3 -3
- package/dist/{chunk-M6DTXZQK.js → chunk-IUOUNRLH.js} +2 -2
- package/dist/{chunk-FXW3FW4A.js → chunk-JSQOHMNJ.js} +1 -1
- package/dist/{chunk-FLUKEZMH.js → chunk-JYXIARGW.js} +1 -1
- package/dist/{chunk-QWUWQBIJ.js → chunk-JZKEC4XJ.js} +5 -2
- package/dist/{chunk-6PUHW2FP.js → chunk-K5CAURU5.js} +4 -4
- package/dist/{chunk-FBFPQLJG.js → chunk-KIH5BDH5.js} +2 -7
- package/dist/{chunk-74DKFWU2.js → chunk-KSVCCSAO.js} +5 -5
- package/dist/{chunk-ECQNBLPS.js → chunk-KW6EYFZV.js} +14 -369
- package/dist/{chunk-MWBFB7WA.js → chunk-LVDC3RUE.js} +1 -1
- package/dist/{chunk-7QAL23TB.js → chunk-LVWXRXT7.js} +1 -1
- package/dist/{chunk-L66VPBS5.js → chunk-M7NX25ZA.js} +1 -1
- package/dist/{chunk-KWAOOXSD.js → chunk-MCHOBQHE.js} +5 -5
- package/dist/{chunk-57EOP757.js → chunk-MYBCXDIL.js} +4 -2
- package/dist/{chunk-LW4ZEC3A.js → chunk-N3NSWWNU.js} +1 -1
- package/dist/{chunk-HR3DJWP2.js → chunk-OHD35NPC.js} +2 -2
- package/dist/{chunk-PI2WWZQQ.js → chunk-PZOFPAPG.js} +2 -2
- package/dist/{chunk-4OXULVUA.js → chunk-QDFLBTUP.js} +1 -1
- package/dist/{chunk-DUACX6E3.js → chunk-QP3XPS5U.js} +11 -7
- package/dist/{chunk-G63LBV4Y.js → chunk-QTCFEKLJ.js} +1 -1
- package/dist/{chunk-724266XT.js → chunk-RF74KBF5.js} +9 -9
- package/dist/{chunk-JPTFFZWY.js → chunk-RGQEULXD.js} +11 -11
- package/dist/{chunk-5HRXOANL.js → chunk-S54YLXWW.js} +3 -3
- package/dist/{chunk-M7ZXKMVX.js → chunk-S5LX25XE.js} +1 -1
- package/dist/{chunk-JTQHC3RV.js → chunk-T2AC5VFQ.js} +5 -5
- package/dist/{chunk-VRPDHJGB.js → chunk-T2BEIPK2.js} +4 -4
- package/dist/{chunk-FFGW45DJ.js → chunk-TN74MUMB.js} +8 -8
- package/dist/{chunk-6U3L4K57.js → chunk-UMVVQXAC.js} +2 -2
- package/dist/{chunk-DFZTZRKL.js → chunk-VLJ5C6IT.js} +4 -4
- package/dist/{chunk-SM2DT5KP.js → chunk-VPZ5K72D.js} +1 -1
- package/dist/{chunk-T6GEEMVC.js → chunk-WVP6UQG3.js} +3 -3
- package/dist/{chunk-JSS5RG65.js → chunk-WXZN5CS3.js} +2 -2
- package/dist/{chunk-I6OGFHJT.js → chunk-X6F4BQEE.js} +5 -5
- package/dist/{chunk-HTN7SMKB.js → chunk-XEJV3QSS.js} +76 -29
- package/dist/{chunk-AKBFNTJF.js → chunk-XFUKCBPU.js} +10 -10
- package/dist/{chunk-OX5EYBOC.js → chunk-XTZHUIGJ.js} +1 -1
- package/dist/{chunk-WNVQPGLH.js → chunk-XWY4UW62.js} +4 -4
- package/dist/{chunk-S3CQBNUU.js → chunk-XXNT4FGA.js} +1 -1
- package/dist/{chunk-MW3DD3S5.js → chunk-ZEHUWE3X.js} +6 -6
- package/dist/{chunk-RZF2GIPI.js → chunk-ZJNU32VE.js} +21 -6
- package/dist/{chunk-WCPN3GVW.js → chunk-ZL3UR6M5.js} +3 -3
- package/dist/{codex-app-cards-switch-7UIGMEUE.js → codex-app-cards-switch-TVKXJWXE.js} +21 -19
- package/dist/{codex-desktop-launch-66LZ6R4Y.js → codex-desktop-launch-ROTJEEGF.js} +3 -1
- package/dist/{codex-session-launch-3TGHFR7R.js → codex-session-launch-VL6ZQA3N.js} +18 -18
- package/dist/{config-OBDZ2CL3.js → config-SYLUYZQE.js} +3 -3
- package/dist/global-upgrade-IPWV5PTM.js +34 -0
- package/dist/{identity-WJUPU3AK.js → identity-ARPAUNGN.js} +4 -4
- package/dist/{live-capabilities-GACO2VB6.js → live-capabilities-EWTRY2HA.js} +4 -4
- package/dist/{paths-5PWAQF63.js → paths-IZTNMJAQ.js} +5 -3
- package/dist/{reapply-EYPT5EP2.js → reapply-ILKOYYKA.js} +26 -26
- package/dist/src/index.js +21 -21
- package/dist/{upgrade-lock-G2ZPV7ZO.js → upgrade-lock-ML73QXIG.js} +4 -6
- package/dist/{usage-PXBMEKSA.js → usage-OUV76AIY.js} +3 -3
- package/package.json +1 -1
- package/dist/global-upgrade-6M2UXUUL.js +0 -26
|
@@ -2885,30 +2885,32 @@ var timeoutActionWithoutLocalPrompt = ({ mode, timeoutAction }) => mode !== "pus
|
|
|
2885
2885
|
var TIMEOUT_ACTIONS = ["approve", "deny", "escalate", "wait"];
|
|
2886
2886
|
var isTimeoutAction = (value) => typeof value === "string" && TIMEOUT_ACTIONS.includes(value);
|
|
2887
2887
|
var MAX_AGENT_QUESTIONS = 4;
|
|
2888
|
+
var MIN_AGENT_QUESTION_OPTIONS = 2;
|
|
2889
|
+
var MAX_AGENT_QUESTION_OPTIONS = 4;
|
|
2888
2890
|
var AGENT_QUESTION_HEADER_MAX = 40;
|
|
2889
2891
|
var AGENT_QUESTION_OPTION_MAX = 100;
|
|
2890
2892
|
var AGENT_QUESTION_DESCRIPTION_MAX = 500;
|
|
2891
|
-
var
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
...typeof value.description === "string" ? { description: value.description } : {}
|
|
2901
|
-
}];
|
|
2902
|
-
}) : [];
|
|
2903
|
-
if (options.length < 2) return void 0;
|
|
2893
|
+
var agentQuestionOptionIn = (raw) => {
|
|
2894
|
+
if (!isRecord(raw) || typeof raw.label !== "string" || raw.label.length === 0) return [];
|
|
2895
|
+
return [{
|
|
2896
|
+
label: raw.label,
|
|
2897
|
+
...typeof raw.description === "string" ? { description: raw.description } : {}
|
|
2898
|
+
}];
|
|
2899
|
+
};
|
|
2900
|
+
var agentQuestionFieldsIn = (raw) => {
|
|
2901
|
+
if (!isRecord(raw) || typeof raw.question !== "string") return void 0;
|
|
2904
2902
|
return {
|
|
2905
|
-
question:
|
|
2906
|
-
...typeof
|
|
2907
|
-
multiSelect:
|
|
2908
|
-
...typeof
|
|
2909
|
-
options
|
|
2903
|
+
question: raw.question,
|
|
2904
|
+
...typeof raw.header === "string" ? { header: raw.header } : {},
|
|
2905
|
+
multiSelect: raw.multiSelect === true,
|
|
2906
|
+
...typeof raw.allowOther === "boolean" ? { allowOther: raw.allowOther } : {},
|
|
2907
|
+
options: Array.isArray(raw.options) ? raw.options.flatMap(agentQuestionOptionIn) : []
|
|
2910
2908
|
};
|
|
2911
2909
|
};
|
|
2910
|
+
var parseAgentQuestion = (raw) => {
|
|
2911
|
+
const question = agentQuestionFieldsIn(raw);
|
|
2912
|
+
return question && question.options.length >= MIN_AGENT_QUESTION_OPTIONS ? question : void 0;
|
|
2913
|
+
};
|
|
2912
2914
|
var parseAgentQuestions = (toolInput) => {
|
|
2913
2915
|
const questions = toolInput.questions;
|
|
2914
2916
|
if (!Array.isArray(questions) || questions.length === 0) return void 0;
|
|
@@ -2921,13 +2923,16 @@ var parseAgentQuestions = (toolInput) => {
|
|
|
2921
2923
|
}
|
|
2922
2924
|
return parsed;
|
|
2923
2925
|
};
|
|
2926
|
+
var isTypedAnswerQuestion = (question) => question.options.length === 0;
|
|
2927
|
+
var typingCanAnswer = (question) => question.multiSelect === false && question.allowOther !== false;
|
|
2928
|
+
var optionCountCanBeAnswered = (question, optionCount) => optionCount === 0 ? typingCanAnswer(question) : optionCount >= MIN_AGENT_QUESTION_OPTIONS && optionCount <= MAX_AGENT_QUESTION_OPTIONS;
|
|
2924
2929
|
var isAgentQuestionSet = (value) => {
|
|
2925
2930
|
if (!Array.isArray(value) || value.length === 0 || value.length > 4) return false;
|
|
2926
2931
|
const questions = /* @__PURE__ */ new Set();
|
|
2927
2932
|
for (const item of value) {
|
|
2928
|
-
if (!
|
|
2933
|
+
if (!isRecord(item)) return false;
|
|
2929
2934
|
const question = item;
|
|
2930
|
-
if (typeof question.question !== "string" || question.question.length === 0 || questions.has(question.question) || question.header !== void 0 && typeof question.header !== "string" || typeof question.multiSelect !== "boolean" || question.allowOther !== void 0 && typeof question.allowOther !== "boolean" || !Array.isArray(question.options) || question
|
|
2935
|
+
if (typeof question.question !== "string" || question.question.length === 0 || questions.has(question.question) || question.header !== void 0 && typeof question.header !== "string" || typeof question.multiSelect !== "boolean" || question.allowOther !== void 0 && typeof question.allowOther !== "boolean" || !Array.isArray(question.options) || !optionCountCanBeAnswered(question, question.options.length)) return false;
|
|
2931
2936
|
const labels = /* @__PURE__ */ new Set();
|
|
2932
2937
|
for (const option of question.options) {
|
|
2933
2938
|
if (!option || typeof option !== "object" || Array.isArray(option)) return false;
|
|
@@ -2971,19 +2976,34 @@ var parseAgentQuestionAnswers = (questions, value) => {
|
|
|
2971
2976
|
}
|
|
2972
2977
|
return answers;
|
|
2973
2978
|
};
|
|
2979
|
+
var noOptionsWhenAbsent = (options) => options ?? [];
|
|
2980
|
+
var optionsNamedByLabel = (options) => Array.isArray(options) ? options.map((label) => ({ label })) : options;
|
|
2981
|
+
var offersOnlyItsOptions = (raw, options) => raw.isOther === false && Array.isArray(options) && options.length > 0;
|
|
2974
2982
|
var codexQuestionFields = (raw, toolName) => {
|
|
2975
2983
|
if (!isRecord(raw) || raw.isSecret === true) return void 0;
|
|
2984
|
+
const options = noOptionsWhenAbsent(raw.options);
|
|
2976
2985
|
if (toolName === CODEX_ASYNC_QUESTION_TOOL) {
|
|
2977
|
-
|
|
2978
|
-
return { question: raw.title, options: labels.map((label) => ({ label })), multiSelect: false };
|
|
2986
|
+
return { question: raw.title, options: optionsNamedByLabel(options), multiSelect: false };
|
|
2979
2987
|
}
|
|
2980
|
-
return { ...raw, multiSelect: raw.multiSelect ?? false, ...raw
|
|
2988
|
+
return { ...raw, options, multiSelect: raw.multiSelect ?? false, ...offersOnlyItsOptions(raw, options) ? { allowOther: false } : {} };
|
|
2981
2989
|
};
|
|
2990
|
+
var agentQuestionsOf = (questions) => questions.flatMap((question) => agentQuestionFieldsIn(question) ?? []);
|
|
2982
2991
|
var parseCodexQuestions = (toolName, toolInput) => {
|
|
2983
2992
|
const raw = Array.isArray(toolInput.questions) ? toolInput.questions : [];
|
|
2984
2993
|
const questions = raw.map((question) => codexQuestionFields(question, toolName));
|
|
2985
|
-
return isAgentQuestionSet(questions) ?
|
|
2986
|
-
};
|
|
2994
|
+
return isAgentQuestionSet(questions) ? agentQuestionsOf(questions) : void 0;
|
|
2995
|
+
};
|
|
2996
|
+
var typedTextAsAnswers = (questions, text2) => {
|
|
2997
|
+
const [only, ...others] = questions;
|
|
2998
|
+
if (!only || others.length > 0 || !isTypedAnswerQuestion(only)) return null;
|
|
2999
|
+
if (text2.trim().length === 0 || isHandBackAnswer(text2)) return null;
|
|
3000
|
+
return { [only.question]: text2 };
|
|
3001
|
+
};
|
|
3002
|
+
var plainAskOf = (question) => isTypedAnswerQuestion(question) ? { type: "input" } : { type: "select", options: question.options.map((option) => option.label) };
|
|
3003
|
+
var isLoneTypedAnswerQuestion = (questions) => questions.length === 1 && questions.every(isTypedAnswerQuestion);
|
|
3004
|
+
var questionsShownAsASet = (questions) => isLoneTypedAnswerQuestion(questions) ? void 0 : questions;
|
|
3005
|
+
var agentQuestionContext = (header, project) => header ? `${header}: your agent is asking in ${project}` : `Your agent is asking in ${project}`;
|
|
3006
|
+
var answersToQuestionsAsAsked = (questions, answer) => questionsShownAsASet(questions) ? parseAgentQuestionAnswers(questions, answer) : typedTextAsAnswers(questions, answer);
|
|
2987
3007
|
var CODEX_QUESTION_ANSWERED_IN_PUSHARY = "The user already answered this question in Pushary, so it was not shown again";
|
|
2988
3008
|
var CODEX_QUESTION_CONTINUE = "Continue with this answer and do not ask it again";
|
|
2989
3009
|
var quotedAnswerPair = ([question, answer]) => `${JSON.stringify(question)}: ${JSON.stringify(answer)}`;
|
|
@@ -6138,6 +6158,7 @@ var elicitationContentFromAnswers = (ask, answers) => {
|
|
|
6138
6158
|
}
|
|
6139
6159
|
return content;
|
|
6140
6160
|
};
|
|
6161
|
+
var isHandBackAnswer = (answer) => classifyConfirmResponse(answer) === "defer";
|
|
6141
6162
|
|
|
6142
6163
|
// ../contracts/src/hook-activation.ts
|
|
6143
6164
|
var hookWritePath = (toolName, input) => toolName === "Write" && typeof input.file_path === "string" && input.file_path.startsWith("/") && input.file_path.length <= 4096 ? input.file_path : void 0;
|
|
@@ -6237,8 +6258,13 @@ export {
|
|
|
6237
6258
|
AGENT_QUESTION_OPTION_MAX,
|
|
6238
6259
|
AGENT_QUESTION_DESCRIPTION_MAX,
|
|
6239
6260
|
parseAgentQuestions,
|
|
6261
|
+
isTypedAnswerQuestion,
|
|
6240
6262
|
parseAgentQuestionAnswers,
|
|
6241
6263
|
parseCodexQuestions,
|
|
6264
|
+
plainAskOf,
|
|
6265
|
+
questionsShownAsASet,
|
|
6266
|
+
agentQuestionContext,
|
|
6267
|
+
answersToQuestionsAsAsked,
|
|
6242
6268
|
codexQuestionAnswerReason,
|
|
6243
6269
|
normalizeInstallSource,
|
|
6244
6270
|
HOOK_BUDGETS,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
announceSubscriptionRequired,
|
|
3
3
|
isDeferAnswer
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VPZ5K72D.js";
|
|
5
5
|
import {
|
|
6
6
|
AUTO_DECISION_WINDOW_MS,
|
|
7
7
|
DEFAULT_SESSION,
|
|
@@ -10,24 +10,30 @@ import {
|
|
|
10
10
|
permissionDeniedAction,
|
|
11
11
|
releaseThrottle,
|
|
12
12
|
reportEvent
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RF74KBF5.js";
|
|
14
14
|
import {
|
|
15
15
|
askUser,
|
|
16
16
|
isDecisionStopped,
|
|
17
17
|
waitForQuestion
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-DQ565WFA.js";
|
|
19
19
|
import {
|
|
20
20
|
SubscriptionRequiredError
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ZL3UR6M5.js";
|
|
22
22
|
import {
|
|
23
23
|
getMachineId
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-IJ6XKKQW.js";
|
|
25
25
|
import {
|
|
26
|
+
ASK_CONTEXT_MAX,
|
|
27
|
+
agentQuestionContext,
|
|
28
|
+
answersToQuestionsAsAsked,
|
|
29
|
+
isTypedAnswerQuestion,
|
|
26
30
|
machineDecisionFor,
|
|
27
31
|
parseAgentQuestionAnswers,
|
|
32
|
+
plainAskOf,
|
|
33
|
+
questionsShownAsASet,
|
|
28
34
|
shouldDeferToNativeMode,
|
|
29
35
|
wireVerdictFor
|
|
30
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-GZL3KEPC.js";
|
|
31
37
|
|
|
32
38
|
// src/machine-decision-audit.ts
|
|
33
39
|
import { basename } from "path";
|
|
@@ -87,11 +93,15 @@ var UNAVAILABLE = { kind: "unavailable" };
|
|
|
87
93
|
var UNANSWERED = { kind: "unanswered" };
|
|
88
94
|
var answeredWith = (answers) => ({ kind: "answered", answers });
|
|
89
95
|
var failedAskOutcome = (error, sessionId) => outcomeOfFailedAsk(error, sessionId, UNAVAILABLE) ?? UNANSWERED;
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
var cardOf = (question) => {
|
|
97
|
+
const ask = plainAskOf(question);
|
|
98
|
+
const shownAsASet = questionsShownAsASet([question]);
|
|
99
|
+
return {
|
|
100
|
+
type: ask.type,
|
|
101
|
+
...ask.type === "select" ? { options: [...ask.options] } : {},
|
|
102
|
+
...shownAsASet ? { questions: [...shownAsASet] } : {}
|
|
103
|
+
};
|
|
104
|
+
};
|
|
95
105
|
var outcomeOfFailedAsk = (error, sessionId, failure) => {
|
|
96
106
|
if (!(error instanceof SubscriptionRequiredError)) return failure;
|
|
97
107
|
announceSubscriptionRequired(error.upgradeUrl, sessionId);
|
|
@@ -102,18 +112,19 @@ var storedWaitDeadline = (result, requestedDeadline) => {
|
|
|
102
112
|
return Number.isFinite(stored) ? Math.min(stored, requestedDeadline) : requestedDeadline;
|
|
103
113
|
};
|
|
104
114
|
var questionContext = (question, index, total, project) => {
|
|
105
|
-
const subject = question.header
|
|
106
|
-
|
|
115
|
+
const subject = agentQuestionContext(question.header, project);
|
|
116
|
+
const line = total > 1 ? `${subject} (${index + 1} of ${total})` : subject;
|
|
117
|
+
return line.slice(0, ASK_CONTEXT_MAX);
|
|
107
118
|
};
|
|
108
119
|
var legacyAnswerMap = (question, value) => JSON.stringify({ [question.question]: question.multiSelect ? JSON.stringify([value]) : value });
|
|
109
|
-
var
|
|
120
|
+
var answerInTheEarlierForm = (question, value) => isTypedAnswerQuestion(question) ? null : parseAgentQuestionAnswers([question], legacyAnswerMap(question, value));
|
|
121
|
+
var answersOnOneCard = (question, value) => answersToQuestionsAsAsked([question], value) ?? answerInTheEarlierForm(question, value);
|
|
122
|
+
var askAsOneCard = async (apiKey, call, only) => {
|
|
110
123
|
let result;
|
|
111
124
|
try {
|
|
112
125
|
result = await askUser(apiKey, {
|
|
113
126
|
question: only.question,
|
|
114
|
-
|
|
115
|
-
options: [...only.labels],
|
|
116
|
-
questions: labelled.map(withoutLabels),
|
|
127
|
+
...cardOf(only),
|
|
117
128
|
context: questionContext(only, 0, 1, call.projectName),
|
|
118
129
|
agentName: call.agentName,
|
|
119
130
|
sessionId: call.sessionId,
|
|
@@ -128,23 +139,21 @@ var askAsOneCard = async (apiKey, call, only, labelled) => {
|
|
|
128
139
|
if (isDecisionStopped(result)) return STOPPED;
|
|
129
140
|
const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, call.deadline));
|
|
130
141
|
if (isDecisionStopped(answer)) return STOPPED;
|
|
131
|
-
const values = answer.answered && answer.value ?
|
|
142
|
+
const values = answer.answered && answer.value ? answersToQuestionsAsAsked([only], answer.value) : null;
|
|
132
143
|
if (!values || isDeferAnswer(answer.value)) {
|
|
133
144
|
return UNANSWERED;
|
|
134
145
|
}
|
|
135
146
|
return answeredWith(values);
|
|
136
147
|
};
|
|
137
|
-
var askQuestionByQuestion = async (apiKey, call,
|
|
148
|
+
var askQuestionByQuestion = async (apiKey, call, questions) => {
|
|
138
149
|
const answers = {};
|
|
139
|
-
for (const [index, question] of
|
|
150
|
+
for (const [index, question] of questions.entries()) {
|
|
140
151
|
let result;
|
|
141
152
|
try {
|
|
142
153
|
result = await askUser(apiKey, {
|
|
143
154
|
question: question.question,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
questions: [withoutLabels(question)],
|
|
147
|
-
context: questionContext(question, index, labelled.length, call.projectName),
|
|
155
|
+
...cardOf(question),
|
|
156
|
+
context: questionContext(question, index, questions.length, call.projectName),
|
|
148
157
|
agentName: call.agentName,
|
|
149
158
|
sessionId: call.sessionId,
|
|
150
159
|
machineId: getMachineId(),
|
|
@@ -159,7 +168,7 @@ var askQuestionByQuestion = async (apiKey, call, labelled) => {
|
|
|
159
168
|
const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, call.deadline));
|
|
160
169
|
if (isDecisionStopped(answer)) return STOPPED;
|
|
161
170
|
const legacyValue = answer.answered ? answer.value?.trim() : void 0;
|
|
162
|
-
const values = legacyValue ?
|
|
171
|
+
const values = legacyValue ? answersOnOneCard(question, legacyValue) : null;
|
|
163
172
|
const value = values?.[question.question];
|
|
164
173
|
if (!value || isDeferAnswer(answer.value)) {
|
|
165
174
|
return UNANSWERED;
|
|
@@ -169,10 +178,9 @@ var askQuestionByQuestion = async (apiKey, call, labelled) => {
|
|
|
169
178
|
return answeredWith(answers);
|
|
170
179
|
};
|
|
171
180
|
var askAgentQuestions = (apiKey, call, questions) => {
|
|
172
|
-
const
|
|
173
|
-
const [only, ...rest] = labelled;
|
|
181
|
+
const [only, ...rest] = questions;
|
|
174
182
|
if (!only) return Promise.resolve(UNANSWERED);
|
|
175
|
-
return rest.length === 0 ? askAsOneCard(apiKey, call, only
|
|
183
|
+
return rest.length === 0 ? askAsOneCard(apiKey, call, only) : askQuestionByQuestion(apiKey, call, questions);
|
|
176
184
|
};
|
|
177
185
|
|
|
178
186
|
export {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MCP_BRIDGE_BINARY
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4LUPZ347.js";
|
|
4
4
|
import {
|
|
5
5
|
KEY_FILE_MODE
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IRZ5FVWG.js";
|
|
7
7
|
import {
|
|
8
8
|
NpmInstallError,
|
|
9
9
|
NpmMissingError,
|
|
10
10
|
NpmPermissionError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WVP6UQG3.js";
|
|
12
12
|
import {
|
|
13
13
|
readJsonSafe,
|
|
14
14
|
writeFileAtomic,
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
} from "./chunk-QENTGE75.js";
|
|
17
17
|
import {
|
|
18
18
|
NPX_LATEST_COMMAND
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-5SFM6XB4.js";
|
|
20
20
|
import {
|
|
21
21
|
readSetupAgentFailures
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-GZL3KEPC.js";
|
|
23
23
|
|
|
24
24
|
// src/instruction-file.ts
|
|
25
25
|
import { accessSync, constants, existsSync, readFileSync, statSync, writeFileSync, mkdirSync, rmSync } from "fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveInstallSourceFor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7RZO6VWD.js";
|
|
4
4
|
import {
|
|
5
5
|
backupFile,
|
|
6
6
|
readJsonSafe,
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
} from "./chunk-QENTGE75.js";
|
|
10
10
|
import {
|
|
11
11
|
configFilePath
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LVDC3RUE.js";
|
|
13
13
|
import {
|
|
14
14
|
API_KEY_PREFIX_PATTERN,
|
|
15
15
|
isRecord
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GZL3KEPC.js";
|
|
17
17
|
|
|
18
18
|
// src/shell-alias.ts
|
|
19
19
|
import { homedir } from "os";
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
decodePublicKey,
|
|
4
4
|
generateSessionKey,
|
|
5
5
|
wrapSessionKey
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JSQOHMNJ.js";
|
|
7
7
|
import {
|
|
8
8
|
fetchTranscriptRecipients,
|
|
9
9
|
uploadTranscriptRecords
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-N3NSWWNU.js";
|
|
11
11
|
|
|
12
12
|
// src/live-session.ts
|
|
13
13
|
var MAX_TRANSCRIPT_QUEUE = 100;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-POFBE6ZY.js";
|
|
4
4
|
import {
|
|
5
5
|
autoUpdateState
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MYBCXDIL.js";
|
|
7
7
|
import {
|
|
8
8
|
readJsonSafe,
|
|
9
9
|
writeJsonAtomic
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-QTOLNRET.js";
|
|
18
18
|
import {
|
|
19
19
|
isAutoUpdateResult
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GZL3KEPC.js";
|
|
21
21
|
|
|
22
22
|
// src/auto-update.ts
|
|
23
23
|
import { spawn } from "child_process";
|
|
@@ -155,6 +155,7 @@ var describeAutoUpdateCheck = (state) => {
|
|
|
155
155
|
var UNFINISHED_AUTO_UPDATE_RESULTS = ["failed", "finish_pending", "finish_blocked"];
|
|
156
156
|
var isUnfinishedAutoUpdate = (state) => state.lastResult !== void 0 && UNFINISHED_AUTO_UPDATE_RESULTS.includes(state.lastResult);
|
|
157
157
|
var isRetryableFinishRecord = (state) => state.lastResult === "finish_pending" || state.lastResult === "updated" && Boolean(state.detail);
|
|
158
|
+
var holdsUnfinishedFinish = (state) => state.lastResult === "finish_pending" || state.lastResult === "finish_blocked";
|
|
158
159
|
var hasRetryableUpgradeFinish = (state, installed) => state.to === installed && isRetryableFinishRecord(state);
|
|
159
160
|
var hasSettledUpgradeFinish = (state, installed) => state.to === installed && state.lastResult === "finish_blocked";
|
|
160
161
|
var hasPendingUpgradeFinish = (state, installed) => hasRetryableUpgradeFinish(state, installed) || hasSettledUpgradeFinish(state, installed);
|
|
@@ -217,9 +218,11 @@ export {
|
|
|
217
218
|
parseAutoUpdateFlag,
|
|
218
219
|
describeAutoUpdateCheck,
|
|
219
220
|
isUnfinishedAutoUpdate,
|
|
221
|
+
holdsUnfinishedFinish,
|
|
220
222
|
hasRetryableUpgradeFinish,
|
|
221
223
|
hasSettledUpgradeFinish,
|
|
222
224
|
hasPendingUpgradeFinish,
|
|
225
|
+
pendingAutoUpdateAnnouncement,
|
|
223
226
|
describeAutoUpdateAnnouncement,
|
|
224
227
|
takeAutoUpdateAnnouncement,
|
|
225
228
|
readAutoUpdateState,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTranscript
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TN74MUMB.js";
|
|
4
4
|
import {
|
|
5
5
|
namedEvent
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XWY4UW62.js";
|
|
7
7
|
import {
|
|
8
8
|
writeDegraded
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DQ565WFA.js";
|
|
10
10
|
import {
|
|
11
11
|
claudeShapedHookInput,
|
|
12
12
|
hookCompatibleProfileBySource,
|
|
13
13
|
isGrokHookPayload,
|
|
14
14
|
isGrokSessionEndStop
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GZL3KEPC.js";
|
|
16
16
|
|
|
17
17
|
// src/tool-hook-input.ts
|
|
18
18
|
var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
autoUpdateLock
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MYBCXDIL.js";
|
|
4
4
|
import {
|
|
5
5
|
installPackageGlobally,
|
|
6
6
|
npmErrorMessage
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WVP6UQG3.js";
|
|
8
8
|
import {
|
|
9
9
|
writeJsonAtomic
|
|
10
10
|
} from "./chunk-QENTGE75.js";
|
|
@@ -159,10 +159,6 @@ var forkFinishWithUpgradeLock = (request) => new Promise((resolve, reject) => {
|
|
|
159
159
|
resolve({ code, signal });
|
|
160
160
|
});
|
|
161
161
|
});
|
|
162
|
-
var finishWithUpgradeLock = async (request) => {
|
|
163
|
-
const exit = await forkFinishWithUpgradeLock(request);
|
|
164
|
-
if (exit.code !== 0) throw new Error(`Upgrade finish exited with ${exit.signal ?? exit.code}`);
|
|
165
|
-
};
|
|
166
162
|
var installWithUpgradeLock = (request, lockPath = autoUpdateLock(), runNpm) => {
|
|
167
163
|
const path = canonicalLockPath(lockPath);
|
|
168
164
|
if (!heldLocks.has(path)) throw new Error("Cannot install an upgrade without its lock");
|
|
@@ -176,6 +172,5 @@ export {
|
|
|
176
172
|
ownsUpgradeLock,
|
|
177
173
|
releaseAutoUpdateLock,
|
|
178
174
|
forkFinishWithUpgradeLock,
|
|
179
|
-
finishWithUpgradeLock,
|
|
180
175
|
installWithUpgradeLock
|
|
181
176
|
};
|
|
@@ -2,23 +2,23 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ATUZX4K7.js";
|
|
6
6
|
import {
|
|
7
7
|
AGENT_CHOICES
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ECJJKDP7.js";
|
|
9
9
|
import {
|
|
10
10
|
BELL_HOOK_BINARY
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QDFLBTUP.js";
|
|
12
12
|
import {
|
|
13
13
|
CODEX_HOOK_EVENTS,
|
|
14
14
|
hasCodexHooks,
|
|
15
15
|
holdBudgetOf
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MYBCXDIL.js";
|
|
17
17
|
import {
|
|
18
18
|
CURSOR_GATE_EVENTS,
|
|
19
19
|
HOOK_LOCATOR_BINARY,
|
|
20
20
|
hookCommandHoldBudget
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-GZL3KEPC.js";
|
|
22
22
|
|
|
23
23
|
// src/diagnostics/bridge.ts
|
|
24
24
|
import { execFileSync } from "child_process";
|