@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
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
describeAppRepair,
|
|
3
|
+
describeJustPairedRepair,
|
|
4
|
+
describeReach,
|
|
5
|
+
describeVerifyOutcome,
|
|
6
|
+
ownAppPlatforms,
|
|
7
|
+
reachVerdict,
|
|
8
|
+
reachesYou,
|
|
9
|
+
verifyDelivery
|
|
10
|
+
} from "./chunk-CZULJ647.js";
|
|
1
11
|
import {
|
|
2
12
|
generateKeypair,
|
|
3
13
|
openSealedKey,
|
|
@@ -12,371 +22,16 @@ import {
|
|
|
12
22
|
terminalColumns,
|
|
13
23
|
useColor
|
|
14
24
|
} from "./chunk-FO3MDD26.js";
|
|
15
|
-
import {
|
|
16
|
-
callMcpTool
|
|
17
|
-
} from "./chunk-WCPN3GVW.js";
|
|
18
25
|
import {
|
|
19
26
|
reportedInstallSource
|
|
20
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-7RZO6VWD.js";
|
|
21
28
|
import {
|
|
22
29
|
NPX_LATEST_COMMAND
|
|
23
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-5SFM6XB4.js";
|
|
24
31
|
import {
|
|
25
32
|
NO_PAIRING_COMPUTER,
|
|
26
|
-
PAIR_TTL_SECONDS
|
|
27
|
-
|
|
28
|
-
isAnswerSource
|
|
29
|
-
} from "./chunk-WACFIQYA.js";
|
|
30
|
-
|
|
31
|
-
// src/reach.ts
|
|
32
|
-
var reachVerdict = (channels) => {
|
|
33
|
-
const { yours, site } = channels;
|
|
34
|
-
if (yours === null || site === null) {
|
|
35
|
-
return channels.phoneReachable || channels.webActive > 0 ? { kind: "yours" } : { kind: "nobody" };
|
|
36
|
-
}
|
|
37
|
-
if (yours.phoneReachable) return { kind: "yours" };
|
|
38
|
-
const solo = site.otherMembers === 0;
|
|
39
|
-
if (solo) {
|
|
40
|
-
return site.phoneReachable || site.webActive > 0 ? { kind: "yours" } : { kind: "nobody" };
|
|
41
|
-
}
|
|
42
|
-
if (site.appDevices === 0 && site.webActive === 0) return { kind: "nobody" };
|
|
43
|
-
if (site.webActive > 0 && !yours.webAttributable) {
|
|
44
|
-
return { kind: "unattributable", otherMembers: site.otherMembers };
|
|
45
|
-
}
|
|
46
|
-
return { kind: "others", otherMembers: site.otherMembers };
|
|
47
|
-
};
|
|
48
|
-
var reachesYou = (channels) => reachVerdict(channels).kind === "yours";
|
|
49
|
-
var plural = (count, one, many = `${one}s`) => `${count} ${count === 1 ? one : many}`;
|
|
50
|
-
var describeReach = (channels) => {
|
|
51
|
-
const verdict = reachVerdict(channels);
|
|
52
|
-
if (verdict.kind === "nobody") return "nothing can receive an approval";
|
|
53
|
-
const parts = [];
|
|
54
|
-
const own = channels.yours;
|
|
55
|
-
if (verdict.kind === "yours" && own !== null && own.appDevices > 0) {
|
|
56
|
-
const platforms = own.appPlatforms.length > 0 ? ` (${own.appPlatforms.join(", ")})` : "";
|
|
57
|
-
parts.push(`${plural(own.appDevices, "app device")}${platforms}`);
|
|
58
|
-
} else if (channels.appDevices > 0) {
|
|
59
|
-
const platforms = channels.appPlatforms.length > 0 ? ` (${channels.appPlatforms.join(", ")})` : "";
|
|
60
|
-
parts.push(`${plural(channels.appDevices, "app device")}${platforms}`);
|
|
61
|
-
}
|
|
62
|
-
if (channels.webPhone > 0) parts.push(`${plural(channels.webPhone, "browser")} on a phone`);
|
|
63
|
-
if (channels.webDesktop > 0) parts.push(`${plural(channels.webDesktop, "browser")} on a desktop`);
|
|
64
|
-
const summary = parts.length > 0 ? parts.join(", ") : "a device";
|
|
65
|
-
if (verdict.kind === "others") return `${summary}, none of them yours`;
|
|
66
|
-
if (verdict.kind === "unattributable") return `${summary}, and no way to tell whose`;
|
|
67
|
-
return summary;
|
|
68
|
-
};
|
|
69
|
-
var describeAppRepair = (verdict) => {
|
|
70
|
-
switch (verdict.kind) {
|
|
71
|
-
case "yours":
|
|
72
|
-
return null;
|
|
73
|
-
case "nobody":
|
|
74
|
-
return [
|
|
75
|
-
"Open the Pushary app, sign in, and allow notifications.",
|
|
76
|
-
`If this terminal was never paired with your phone, run: ${NPX_LATEST_COMMAND} setup --connect app`
|
|
77
|
-
];
|
|
78
|
-
case "others":
|
|
79
|
-
return [
|
|
80
|
-
`Reachable devices belong to other members of this workspace (${verdict.otherMembers}).`,
|
|
81
|
-
"Sign in on the Pushary app with your own account so approvals can reach you."
|
|
82
|
-
];
|
|
83
|
-
case "unattributable":
|
|
84
|
-
return [
|
|
85
|
-
"Something is reachable here, but not identifiably yours.",
|
|
86
|
-
"Sign in on the Pushary app so your approvals are routed to your device."
|
|
87
|
-
];
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
var describeJustPairedRepair = (verdict) => {
|
|
91
|
-
if (verdict.kind === "nobody") {
|
|
92
|
-
return [
|
|
93
|
-
"The app asks for the notification permission after it grants the pairing.",
|
|
94
|
-
"Open the Pushary app and allow notifications. That is the whole remaining step."
|
|
95
|
-
];
|
|
96
|
-
}
|
|
97
|
-
return describeAppRepair(verdict) ?? [];
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// src/setup/verify.ts
|
|
101
|
-
var plural2 = (count, one) => `${count} ${one}${count === 1 ? "" : "s"}`;
|
|
102
|
-
var SETUP_AGENT_NAME = "Pushary setup";
|
|
103
|
-
var ownAppPlatforms = (channels) => channels.yours?.appPlatforms ?? channels.appPlatforms;
|
|
104
|
-
var describeRecipients = (push, channels) => {
|
|
105
|
-
const parts = [];
|
|
106
|
-
if (push.app > 0) {
|
|
107
|
-
const platforms = ownAppPlatforms(channels);
|
|
108
|
-
const suffix = platforms.length > 0 ? ` (${platforms.join(", ")})` : "";
|
|
109
|
-
parts.push(`${plural2(push.app, "app device")}${suffix}`);
|
|
110
|
-
}
|
|
111
|
-
if (push.web > 0) parts.push(plural2(push.web, "browser"));
|
|
112
|
-
return parts.length > 0 ? parts.join(" and ") : plural2(push.total, "device");
|
|
113
|
-
};
|
|
114
|
-
var classifyDelivery = (channels, push) => {
|
|
115
|
-
if (push.total <= 0) return { kind: "no-recipients" };
|
|
116
|
-
const verdict = reachVerdict(channels);
|
|
117
|
-
if (verdict.kind === "yours" && (push.app > 0 || channels.yours === null || channels.site?.otherMembers === 0)) {
|
|
118
|
-
return { kind: "delivered", recipients: push.total, deviceLabel: describeRecipients(push, channels) };
|
|
119
|
-
}
|
|
120
|
-
if (verdict.kind === "unattributable") {
|
|
121
|
-
return { kind: "unattributable", recipients: push.total, otherMembers: verdict.otherMembers };
|
|
122
|
-
}
|
|
123
|
-
if (verdict.kind === "others") {
|
|
124
|
-
return { kind: "others-only", recipients: push.total, otherMembers: verdict.otherMembers };
|
|
125
|
-
}
|
|
126
|
-
if (verdict.kind === "yours") {
|
|
127
|
-
const otherMembers = channels.site?.otherMembers ?? 0;
|
|
128
|
-
return { kind: "unattributable", recipients: push.total, otherMembers };
|
|
129
|
-
}
|
|
130
|
-
return { kind: "delivered", recipients: push.total, deviceLabel: describeRecipients(push, channels) };
|
|
131
|
-
};
|
|
132
|
-
var sendTestNotification = async (apiKey) => {
|
|
133
|
-
const result = await callMcpTool(apiKey, "send_notification", {
|
|
134
|
-
title: "Pushary is connected",
|
|
135
|
-
body: "This setup notification reached you. Agent hooks still need a real-agent check.",
|
|
136
|
-
agentName: SETUP_AGENT_NAME
|
|
137
|
-
}, { timeoutMs: 2e4 });
|
|
138
|
-
const toCount = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
139
|
-
const app = toCount(result.delivery?.mobile?.recipients);
|
|
140
|
-
const web = toCount(result.delivery?.web?.recipients);
|
|
141
|
-
return { app, web, total: typeof result.sent === "number" ? result.sent : app + web };
|
|
142
|
-
};
|
|
143
|
-
var verifyDelivery = async (apiKey, channels, deps = {}) => {
|
|
144
|
-
const send = deps.send ?? sendTestNotification;
|
|
145
|
-
try {
|
|
146
|
-
return classifyDelivery(channels, await send(apiKey));
|
|
147
|
-
} catch (err) {
|
|
148
|
-
return { kind: "error", detail: err instanceof Error ? err.message : "send failed" };
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
var describeVerifyOutcome = (outcome) => {
|
|
152
|
-
switch (outcome.kind) {
|
|
153
|
-
case "delivered":
|
|
154
|
-
return { ok: true, message: `Delivered to ${outcome.deviceLabel}. Push works.`, next: [] };
|
|
155
|
-
case "no-recipients":
|
|
156
|
-
return {
|
|
157
|
-
ok: false,
|
|
158
|
-
message: "Nothing to deliver to. Agents are configured; approvals will fall back to the terminal.",
|
|
159
|
-
next: [
|
|
160
|
-
"Run pushary pair to pair your phone.",
|
|
161
|
-
"Then pushary doctor --roundtrip to test a synthetic question and answer."
|
|
162
|
-
]
|
|
163
|
-
};
|
|
164
|
-
case "others-only":
|
|
165
|
-
return {
|
|
166
|
-
ok: false,
|
|
167
|
-
message: `Delivered to ${plural2(outcome.recipients, "device")} on this site, none of them yours.`,
|
|
168
|
-
next: [
|
|
169
|
-
`Approvals for your agent would wake one of your ${plural2(outcome.otherMembers, "teammate")}.`,
|
|
170
|
-
"Run pushary pair to pair your own phone."
|
|
171
|
-
]
|
|
172
|
-
};
|
|
173
|
-
case "unattributable":
|
|
174
|
-
return {
|
|
175
|
-
ok: false,
|
|
176
|
-
message: `Delivered to ${plural2(outcome.recipients, "device")} on this site, and no way to tell whose.`,
|
|
177
|
-
next: [
|
|
178
|
-
"Browser subscriptions carry no owner, and this site has other members.",
|
|
179
|
-
"Install the Pushary app and pair it with pushary pair, or run pushary doctor --roundtrip to prove it reaches you."
|
|
180
|
-
]
|
|
181
|
-
};
|
|
182
|
-
case "error":
|
|
183
|
-
return {
|
|
184
|
-
ok: false,
|
|
185
|
-
message: `Could not send the test notification (${outcome.detail}).`,
|
|
186
|
-
next: ["Agents are configured. Run pushary doctor once the connection is back."]
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
var ROUND_TRIP_QUESTION = "Pushary delivery test. Answer either way to test returning an answer. This does not test your agent hooks.";
|
|
191
|
-
var ROUND_TRIP_TIMEOUT_MS = 55e3;
|
|
192
|
-
var reportNoInterrupt = async () => {
|
|
193
|
-
};
|
|
194
|
-
var defaultAsk = (apiKey, agentName) => (
|
|
195
|
-
// wait:false so the poll is ours: the blocking form returns on the SITE's
|
|
196
|
-
// policy timeout, which a user may have set to seconds, and a setup check
|
|
197
|
-
// reporting "unanswered" after three seconds would be a lie about the product.
|
|
198
|
-
callMcpTool(apiKey, "ask_user", {
|
|
199
|
-
question: ROUND_TRIP_QUESTION,
|
|
200
|
-
type: "confirm",
|
|
201
|
-
agentName,
|
|
202
|
-
wait: false
|
|
203
|
-
}, { timeoutMs: 15e3 })
|
|
204
|
-
);
|
|
205
|
-
var defaultWait = (apiKey, correlationId) => callMcpTool(apiKey, "wait_for_answer", {
|
|
206
|
-
correlationId,
|
|
207
|
-
timeoutMs: ROUND_TRIP_TIMEOUT_MS
|
|
208
|
-
}, { timeoutMs: ROUND_TRIP_TIMEOUT_MS + 5e3 });
|
|
209
|
-
var defaultCancel = async (apiKey, correlationId) => {
|
|
210
|
-
await callMcpTool(apiKey, "cancel_question", { correlationId }, { timeoutMs: 1e4 }).catch(() => {
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
var answeredRoundTrip = (answer, correlationId, latencyMs) => {
|
|
214
|
-
if (answer.value === void 0 || classifyConfirmResponse(answer.value) === null) {
|
|
215
|
-
return { kind: "error", detail: "the server reported an answer without a valid Yes, No or defer value" };
|
|
216
|
-
}
|
|
217
|
-
return {
|
|
218
|
-
kind: "answered",
|
|
219
|
-
value: answer.value,
|
|
220
|
-
latencyMs,
|
|
221
|
-
correlationId,
|
|
222
|
-
...isAnswerSource(answer.answerSource) ? { answerSource: answer.answerSource } : {}
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
var verifyRoundTrip = async (apiKey, agentName = SETUP_AGENT_NAME, deps = {}) => {
|
|
226
|
-
const ask = deps.ask ?? defaultAsk;
|
|
227
|
-
const wait = deps.wait ?? defaultWait;
|
|
228
|
-
const cancel = deps.cancel ?? defaultCancel;
|
|
229
|
-
const interrupted = deps.interrupted ?? reportNoInterrupt;
|
|
230
|
-
const now = deps.now ?? Date.now;
|
|
231
|
-
const started = now();
|
|
232
|
-
let asked;
|
|
233
|
-
try {
|
|
234
|
-
asked = await ask(apiKey, agentName);
|
|
235
|
-
} catch (err) {
|
|
236
|
-
return { kind: "error", detail: err instanceof Error ? err.message : "ask failed" };
|
|
237
|
-
}
|
|
238
|
-
let shutdown;
|
|
239
|
-
const stop = (code) => {
|
|
240
|
-
if (shutdown) return;
|
|
241
|
-
shutdown = (async () => {
|
|
242
|
-
let timer;
|
|
243
|
-
try {
|
|
244
|
-
await Promise.race([
|
|
245
|
-
Promise.all([
|
|
246
|
-
cancel(apiKey, asked.correlationId).catch(() => {
|
|
247
|
-
}),
|
|
248
|
-
interrupted(code).catch(() => {
|
|
249
|
-
})
|
|
250
|
-
]),
|
|
251
|
-
new Promise((resolve) => {
|
|
252
|
-
timer = setTimeout(resolve, 4e3);
|
|
253
|
-
})
|
|
254
|
-
]);
|
|
255
|
-
} finally {
|
|
256
|
-
clearTimeout(timer);
|
|
257
|
-
process.stderr.write("Delivery test interrupted. Cleanup was attempted; an unresolved question expires automatically.\n");
|
|
258
|
-
process.exit(code);
|
|
259
|
-
}
|
|
260
|
-
})();
|
|
261
|
-
};
|
|
262
|
-
const onInterrupt = () => stop(130);
|
|
263
|
-
const onTerminate = () => stop(143);
|
|
264
|
-
if (asked.correlationId) {
|
|
265
|
-
process.on("SIGINT", onInterrupt);
|
|
266
|
-
process.on("SIGTERM", onTerminate);
|
|
267
|
-
}
|
|
268
|
-
let answerObserved = false;
|
|
269
|
-
try {
|
|
270
|
-
if (asked.noDevices || asked.warning) return { kind: "no-recipients" };
|
|
271
|
-
if (asked.mode === "notify_only" || asked.status === "notified") return { kind: "notify-only" };
|
|
272
|
-
if (!asked.correlationId) return { kind: "error", detail: "no correlationId returned" };
|
|
273
|
-
const answer = asked.answered === true ? asked : await wait(apiKey, asked.correlationId);
|
|
274
|
-
if (answer.answered === true) {
|
|
275
|
-
const outcome = answeredRoundTrip(answer, asked.correlationId, now() - started);
|
|
276
|
-
answerObserved = outcome.kind === "answered";
|
|
277
|
-
return outcome;
|
|
278
|
-
}
|
|
279
|
-
return { kind: "unanswered" };
|
|
280
|
-
} catch (err) {
|
|
281
|
-
return { kind: "error", detail: err instanceof Error ? err.message : "wait failed" };
|
|
282
|
-
} finally {
|
|
283
|
-
if (shutdown) await shutdown;
|
|
284
|
-
process.off("SIGINT", onInterrupt);
|
|
285
|
-
process.off("SIGTERM", onTerminate);
|
|
286
|
-
if (!answerObserved && asked.correlationId) await cancel(apiKey, asked.correlationId).catch(() => {
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
var describeAnswerSource = (source) => {
|
|
291
|
-
switch (source) {
|
|
292
|
-
case "mobile_app":
|
|
293
|
-
case "mobile_background":
|
|
294
|
-
return "Answered on your phone.";
|
|
295
|
-
case "mac_app":
|
|
296
|
-
return "Answered on your Mac.";
|
|
297
|
-
case "sandbox":
|
|
298
|
-
return "This was a simulated sandbox answer.";
|
|
299
|
-
default:
|
|
300
|
-
return source ? `Answer source: ${source}. This was a synthetic test.` : "The answering surface was not reported. This was a synthetic test.";
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
var NOTIFICATION_ANSWER_STEPS = /* @__PURE__ */ new Map([
|
|
304
|
-
["ios", "Press and hold the notification, then tap Approve."],
|
|
305
|
-
["android", "Expand the notification, then tap Approve."]
|
|
306
|
-
]);
|
|
307
|
-
var EITHER_PHONE_ANSWER_STEP = "Press and hold the notification on iPhone, or expand it on Android, then tap Approve.";
|
|
308
|
-
var notificationAnswerStep = (appPlatforms) => {
|
|
309
|
-
const platforms = [...new Set(appPlatforms)];
|
|
310
|
-
const [onlyPlatform] = platforms;
|
|
311
|
-
if (onlyPlatform === void 0) return null;
|
|
312
|
-
if (platforms.length > 1) return EITHER_PHONE_ANSWER_STEP;
|
|
313
|
-
return NOTIFICATION_ANSWER_STEPS.get(onlyPlatform) ?? EITHER_PHONE_ANSWER_STEP;
|
|
314
|
-
};
|
|
315
|
-
var WAITING_FOR_TAP = "Waiting for you to tap the notification";
|
|
316
|
-
var WAITING_FOR_ANSWER = "Waiting for your answer";
|
|
317
|
-
var describeAnswerTestPrompt = (appPlatforms) => {
|
|
318
|
-
const step = notificationAnswerStep(appPlatforms);
|
|
319
|
-
return { step, waiting: step === null ? WAITING_FOR_TAP : WAITING_FOR_ANSWER };
|
|
320
|
-
};
|
|
321
|
-
var CHECK_THE_NOTIFICATION_OPENED = "Check the notification actually opened something you could tap, then run pushary doctor --roundtrip.";
|
|
322
|
-
var unansweredNextStep = (appPlatforms) => {
|
|
323
|
-
const step = notificationAnswerStep(appPlatforms);
|
|
324
|
-
return step === null ? CHECK_THE_NOTIFICATION_OPENED : `To send another one, run pushary doctor --roundtrip. ${step}`;
|
|
325
|
-
};
|
|
326
|
-
var describeRoundTripOutcome = (outcome, appPlatforms = []) => {
|
|
327
|
-
switch (outcome.kind) {
|
|
328
|
-
case "answered":
|
|
329
|
-
return {
|
|
330
|
-
ok: true,
|
|
331
|
-
message: `Answered "${outcome.value}" in ${(outcome.latencyMs / 1e3).toFixed(1)}s. ${describeAnswerSource(outcome.answerSource)}`,
|
|
332
|
-
next: []
|
|
333
|
-
};
|
|
334
|
-
case "unanswered":
|
|
335
|
-
return {
|
|
336
|
-
ok: false,
|
|
337
|
-
message: "The question was sent and nothing came back.",
|
|
338
|
-
next: [
|
|
339
|
-
"A push that arrives and cannot be answered is the most common way this breaks, so this is worth resolving now.",
|
|
340
|
-
unansweredNextStep(appPlatforms)
|
|
341
|
-
]
|
|
342
|
-
};
|
|
343
|
-
case "notify-only":
|
|
344
|
-
return {
|
|
345
|
-
ok: true,
|
|
346
|
-
message: "Sent. This site is in notify-only mode, so questions never wait for an answer.",
|
|
347
|
-
next: ["Switch with pushary mode push_first if you want approvals to hold for your phone."]
|
|
348
|
-
};
|
|
349
|
-
case "no-recipients":
|
|
350
|
-
return {
|
|
351
|
-
ok: false,
|
|
352
|
-
message: "Nothing to ask. No phone or browser is connected to this site.",
|
|
353
|
-
next: [
|
|
354
|
-
"Run pushary pair to pair your phone.",
|
|
355
|
-
"Or pushary pair --app if you already have the Pushary app."
|
|
356
|
-
]
|
|
357
|
-
};
|
|
358
|
-
case "error":
|
|
359
|
-
return {
|
|
360
|
-
ok: false,
|
|
361
|
-
message: `Could not complete the round trip (${outcome.detail}).`,
|
|
362
|
-
next: ["Agents are configured. Run pushary doctor --roundtrip once the connection is back."]
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
var describeRoundTrip = (outcome, appPlatforms = []) => {
|
|
367
|
-
const report = describeRoundTripOutcome(outcome, appPlatforms);
|
|
368
|
-
return { ...report, next: [...report.next, "Agent hook activation remains unverified. Restart your agent and check one real approval."] };
|
|
369
|
-
};
|
|
370
|
-
var roundTripEvidence = (outcome) => ({
|
|
371
|
-
kind: outcome?.kind ?? "skipped",
|
|
372
|
-
...outcome?.kind === "answered" ? {
|
|
373
|
-
correlationId: outcome.correlationId ?? null,
|
|
374
|
-
answerSource: outcome.answerSource ?? null,
|
|
375
|
-
value: outcome.value,
|
|
376
|
-
latencyMs: outcome.latencyMs
|
|
377
|
-
} : {},
|
|
378
|
-
hookActivation: "unverified"
|
|
379
|
-
});
|
|
33
|
+
PAIR_TTL_SECONDS
|
|
34
|
+
} from "./chunk-GZL3KEPC.js";
|
|
380
35
|
|
|
381
36
|
// src/onboarding.ts
|
|
382
37
|
import qrcodeTerminal from "qrcode-terminal";
|
|
@@ -1058,16 +713,6 @@ var waitForYourPhone = async (apiKey, options = {}) => {
|
|
|
1058
713
|
};
|
|
1059
714
|
|
|
1060
715
|
export {
|
|
1061
|
-
reachVerdict,
|
|
1062
|
-
describeReach,
|
|
1063
|
-
SETUP_AGENT_NAME,
|
|
1064
|
-
ownAppPlatforms,
|
|
1065
|
-
verifyRoundTrip,
|
|
1066
|
-
notificationAnswerStep,
|
|
1067
|
-
describeAnswerTestPrompt,
|
|
1068
|
-
describeRoundTripOutcome,
|
|
1069
|
-
describeRoundTrip,
|
|
1070
|
-
roundTripEvidence,
|
|
1071
716
|
fetchChannels,
|
|
1072
717
|
connectDevice,
|
|
1073
718
|
confirmAppConnection,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openCodeConfigDirFrom
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T2AC5VFQ.js";
|
|
4
4
|
import {
|
|
5
5
|
nativeClaudeInstallPath
|
|
6
6
|
} from "./chunk-VUFHYMSP.js";
|
|
7
7
|
import {
|
|
8
8
|
grokHome
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XWY4UW62.js";
|
|
10
10
|
import {
|
|
11
11
|
codexHomeFrom
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MYBCXDIL.js";
|
|
13
13
|
import {
|
|
14
14
|
resolvePathBinary
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WVP6UQG3.js";
|
|
16
16
|
import {
|
|
17
17
|
HOOK_COMPATIBLE_PROFILES
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-GZL3KEPC.js";
|
|
19
19
|
|
|
20
20
|
// src/hermes-config.ts
|
|
21
21
|
import { execFileSync } from "child_process";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
quoteIfNeeded
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WVP6UQG3.js";
|
|
4
4
|
import {
|
|
5
5
|
CODEX_QUESTION_TOOLS,
|
|
6
6
|
HOOK_BUDGETS,
|
|
7
7
|
HOOK_LOCATOR_BINARY,
|
|
8
8
|
withHookHoldBudget
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GZL3KEPC.js";
|
|
10
10
|
|
|
11
11
|
// src/setup/paths.ts
|
|
12
12
|
import { homedir as homedir2 } from "os";
|
|
@@ -463,6 +463,7 @@ var claudeMcpReceipt = () => join2(pusharyDir(), "setup", "claude-mcp.json");
|
|
|
463
463
|
var bridgeAgentKey = () => join2(pusharyDir(), "bridge-auth", "agent-key.json");
|
|
464
464
|
var autoUpdateState = () => join2(pusharyDir(), "auto-update.json");
|
|
465
465
|
var autoUpdateLock = () => join2(pusharyDir(), "auto-update.lock");
|
|
466
|
+
var serviceOwedBackMark = () => join2(pusharyDir(), "service-owed-back");
|
|
466
467
|
var autoUpdateLog = () => join2(pusharyDir(), "logs", "auto-update.log");
|
|
467
468
|
var clientReportClaims = () => join2(pusharyDir(), "client-reports");
|
|
468
469
|
var claudeRegistrationReceipt = () => join2(pusharyDir(), "setup", "claude-registration.json");
|
|
@@ -537,6 +538,7 @@ export {
|
|
|
537
538
|
bridgeAgentKey,
|
|
538
539
|
autoUpdateState,
|
|
539
540
|
autoUpdateLock,
|
|
541
|
+
serviceOwedBackMark,
|
|
540
542
|
autoUpdateLog,
|
|
541
543
|
clientReportClaims,
|
|
542
544
|
claudeRegistrationReceipt,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MYBCXDIL.js";
|
|
4
4
|
import {
|
|
5
5
|
readJsonSafe,
|
|
6
6
|
writeFileAtomic
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
serializeDeclinedAgents,
|
|
14
14
|
withDeclinedAgent,
|
|
15
15
|
withoutDeclinedAgent
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GZL3KEPC.js";
|
|
17
17
|
|
|
18
18
|
// src/declined-agents-file.ts
|
|
19
19
|
import { join } from "path";
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
} from "./chunk-XHKBHWLX.js";
|
|
5
5
|
import {
|
|
6
6
|
readControlMode
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IRZ5FVWG.js";
|
|
8
8
|
import {
|
|
9
9
|
getMachineId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IJ6XKKQW.js";
|
|
11
11
|
import {
|
|
12
12
|
pusharyDir
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-MYBCXDIL.js";
|
|
14
14
|
import {
|
|
15
15
|
resolveGlobalBinary
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WVP6UQG3.js";
|
|
17
17
|
import {
|
|
18
18
|
readJsonSafe,
|
|
19
19
|
writeFileAtomic,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-QENTGE75.js";
|
|
23
23
|
import {
|
|
24
24
|
getApiKey
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LVDC3RUE.js";
|
|
26
26
|
import {
|
|
27
27
|
CLI_PACKAGE_NAMES,
|
|
28
28
|
cmdShimTarget,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
} from "./chunk-QTOLNRET.js";
|
|
33
33
|
import {
|
|
34
34
|
isRecord
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-GZL3KEPC.js";
|
|
36
36
|
|
|
37
37
|
// src/daemon-lifecycle.ts
|
|
38
38
|
import { dirname, join, win32 as win32Path } from "path";
|
|
@@ -40,7 +40,9 @@ import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, unlinkSy
|
|
|
40
40
|
import { createHash, randomUUID } from "crypto";
|
|
41
41
|
import { homedir, userInfo } from "os";
|
|
42
42
|
import { execFileSync } from "child_process";
|
|
43
|
+
var daemonIsServing = (status) => status.kind === "running" || status.kind === "version-mismatch" || status.kind === "configuration-mismatch";
|
|
43
44
|
var daemonNeedsHandoff = (status) => status.kind === "version-mismatch" || status.kind === "configuration-mismatch" || status.kind === "unresponsive" && status.processAlive === true;
|
|
45
|
+
var daemonProcessIsThere = (status) => daemonIsServing(status) || daemonNeedsHandoff(status);
|
|
44
46
|
var DAEMON_REMOTE_PROOF_MAX_AGE_MS = 18e4;
|
|
45
47
|
var DAEMON_REMOTE_PROOF_CLOCK_SKEW_MS = 3e4;
|
|
46
48
|
var DAEMON_STARTUP_TIMEOUT_MS = 5e3;
|
|
@@ -573,7 +575,7 @@ var acquireDaemonLease = (options = {}) => {
|
|
|
573
575
|
return { kind: "unavailable", detail: err instanceof Error ? err.message : String(err) };
|
|
574
576
|
}
|
|
575
577
|
const status = readDaemonStatus(options);
|
|
576
|
-
if (status
|
|
578
|
+
if (daemonIsServing(status)) {
|
|
577
579
|
return { kind: "already-running", status };
|
|
578
580
|
}
|
|
579
581
|
const lock = readJsonSafe(lockPath(dir));
|
|
@@ -1121,6 +1123,8 @@ var waitForDaemonRemoteProof = async (options = {}) => {
|
|
|
1121
1123
|
};
|
|
1122
1124
|
|
|
1123
1125
|
export {
|
|
1126
|
+
daemonIsServing,
|
|
1127
|
+
daemonProcessIsThere,
|
|
1124
1128
|
DAEMON_COLD_START_TIMEOUT_MS,
|
|
1125
1129
|
daemonHasRemoteProof,
|
|
1126
1130
|
daemonServiceManagerAvailable,
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
IDLE_PROMPT_NOTIFICATION,
|
|
3
3
|
NOTIFICATION_PUSH_TYPES,
|
|
4
4
|
POSTTOOLUSE_MIRROR_ONLY_TOOLS
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QTCFEKLJ.js";
|
|
6
6
|
import {
|
|
7
7
|
repoKeyFor
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XXNT4FGA.js";
|
|
9
9
|
import {
|
|
10
10
|
cancelQuestion,
|
|
11
11
|
clientErrorKindOf,
|
|
@@ -13,26 +13,26 @@ import {
|
|
|
13
13
|
reportClientError,
|
|
14
14
|
sendNotification,
|
|
15
15
|
waitForAnswer
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-DQ565WFA.js";
|
|
17
17
|
import {
|
|
18
18
|
withRetry
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZL3UR6M5.js";
|
|
20
20
|
import {
|
|
21
21
|
getMachineId
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-IJ6XKKQW.js";
|
|
23
23
|
import {
|
|
24
24
|
reportedInstallSource
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-7RZO6VWD.js";
|
|
26
26
|
import {
|
|
27
27
|
canonicalJson
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-MYBCXDIL.js";
|
|
29
29
|
import {
|
|
30
30
|
writeFileAtomic
|
|
31
31
|
} from "./chunk-QENTGE75.js";
|
|
32
32
|
import {
|
|
33
33
|
getApiKey,
|
|
34
34
|
getBaseUrl
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-LVDC3RUE.js";
|
|
36
36
|
import {
|
|
37
37
|
ACTION_BODY_MAX,
|
|
38
38
|
AGENTS,
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
toToolLookup,
|
|
67
67
|
truncateLine,
|
|
68
68
|
unansweredRefusalReason
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-GZL3KEPC.js";
|
|
70
70
|
|
|
71
71
|
// ../hook-mapping/src/describe.ts
|
|
72
72
|
import { isAbsolute, relative, resolve } from "path";
|