pushary 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
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import {
|
|
2
|
+
callMcpTool
|
|
3
|
+
} from "./chunk-ZL3UR6M5.js";
|
|
4
|
+
import {
|
|
5
|
+
NPX_LATEST_COMMAND
|
|
6
|
+
} from "./chunk-5SFM6XB4.js";
|
|
7
|
+
import {
|
|
8
|
+
classifyConfirmResponse,
|
|
9
|
+
isAnswerSource
|
|
10
|
+
} from "./chunk-GZL3KEPC.js";
|
|
11
|
+
|
|
12
|
+
// src/reach.ts
|
|
13
|
+
var reachVerdict = (channels) => {
|
|
14
|
+
const { yours, site } = channels;
|
|
15
|
+
if (yours === null || site === null) {
|
|
16
|
+
return channels.phoneReachable || channels.webActive > 0 ? { kind: "yours" } : { kind: "nobody" };
|
|
17
|
+
}
|
|
18
|
+
if (yours.phoneReachable) return { kind: "yours" };
|
|
19
|
+
const solo = site.otherMembers === 0;
|
|
20
|
+
if (solo) {
|
|
21
|
+
return site.phoneReachable || site.webActive > 0 ? { kind: "yours" } : { kind: "nobody" };
|
|
22
|
+
}
|
|
23
|
+
if (site.appDevices === 0 && site.webActive === 0) return { kind: "nobody" };
|
|
24
|
+
if (site.webActive > 0 && !yours.webAttributable) {
|
|
25
|
+
return { kind: "unattributable", otherMembers: site.otherMembers };
|
|
26
|
+
}
|
|
27
|
+
return { kind: "others", otherMembers: site.otherMembers };
|
|
28
|
+
};
|
|
29
|
+
var reachesYou = (channels) => reachVerdict(channels).kind === "yours";
|
|
30
|
+
var plural = (count, one, many = `${one}s`) => `${count} ${count === 1 ? one : many}`;
|
|
31
|
+
var describeReach = (channels) => {
|
|
32
|
+
const verdict = reachVerdict(channels);
|
|
33
|
+
if (verdict.kind === "nobody") return "nothing can receive an approval";
|
|
34
|
+
const parts = [];
|
|
35
|
+
const own = channels.yours;
|
|
36
|
+
if (verdict.kind === "yours" && own !== null && own.appDevices > 0) {
|
|
37
|
+
const platforms = own.appPlatforms.length > 0 ? ` (${own.appPlatforms.join(", ")})` : "";
|
|
38
|
+
parts.push(`${plural(own.appDevices, "app device")}${platforms}`);
|
|
39
|
+
} else if (channels.appDevices > 0) {
|
|
40
|
+
const platforms = channels.appPlatforms.length > 0 ? ` (${channels.appPlatforms.join(", ")})` : "";
|
|
41
|
+
parts.push(`${plural(channels.appDevices, "app device")}${platforms}`);
|
|
42
|
+
}
|
|
43
|
+
if (channels.webPhone > 0) parts.push(`${plural(channels.webPhone, "browser")} on a phone`);
|
|
44
|
+
if (channels.webDesktop > 0) parts.push(`${plural(channels.webDesktop, "browser")} on a desktop`);
|
|
45
|
+
const summary = parts.length > 0 ? parts.join(", ") : "a device";
|
|
46
|
+
if (verdict.kind === "others") return `${summary}, none of them yours`;
|
|
47
|
+
if (verdict.kind === "unattributable") return `${summary}, and no way to tell whose`;
|
|
48
|
+
return summary;
|
|
49
|
+
};
|
|
50
|
+
var describeAppRepair = (verdict) => {
|
|
51
|
+
switch (verdict.kind) {
|
|
52
|
+
case "yours":
|
|
53
|
+
return null;
|
|
54
|
+
case "nobody":
|
|
55
|
+
return [
|
|
56
|
+
"Open the Pushary app, sign in, and allow notifications.",
|
|
57
|
+
`If this terminal was never paired with your phone, run: ${NPX_LATEST_COMMAND} setup --connect app`
|
|
58
|
+
];
|
|
59
|
+
case "others":
|
|
60
|
+
return [
|
|
61
|
+
`Reachable devices belong to other members of this workspace (${verdict.otherMembers}).`,
|
|
62
|
+
"Sign in on the Pushary app with your own account so approvals can reach you."
|
|
63
|
+
];
|
|
64
|
+
case "unattributable":
|
|
65
|
+
return [
|
|
66
|
+
"Something is reachable here, but not identifiably yours.",
|
|
67
|
+
"Sign in on the Pushary app so your approvals are routed to your device."
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var describeJustPairedRepair = (verdict) => {
|
|
72
|
+
if (verdict.kind === "nobody") {
|
|
73
|
+
return [
|
|
74
|
+
"The app asks for the notification permission after it grants the pairing.",
|
|
75
|
+
"Open the Pushary app and allow notifications. That is the whole remaining step."
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
return describeAppRepair(verdict) ?? [];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// src/setup/verify.ts
|
|
82
|
+
var plural2 = (count, one) => `${count} ${one}${count === 1 ? "" : "s"}`;
|
|
83
|
+
var SETUP_AGENT_NAME = "Pushary setup";
|
|
84
|
+
var ownAppPlatforms = (channels) => channels.yours?.appPlatforms ?? channels.appPlatforms;
|
|
85
|
+
var describeRecipients = (push, channels) => {
|
|
86
|
+
const parts = [];
|
|
87
|
+
if (push.app > 0) {
|
|
88
|
+
const platforms = ownAppPlatforms(channels);
|
|
89
|
+
const suffix = platforms.length > 0 ? ` (${platforms.join(", ")})` : "";
|
|
90
|
+
parts.push(`${plural2(push.app, "app device")}${suffix}`);
|
|
91
|
+
}
|
|
92
|
+
if (push.web > 0) parts.push(plural2(push.web, "browser"));
|
|
93
|
+
return parts.length > 0 ? parts.join(" and ") : plural2(push.total, "device");
|
|
94
|
+
};
|
|
95
|
+
var classifyDelivery = (channels, push) => {
|
|
96
|
+
if (push.total <= 0) return { kind: "no-recipients" };
|
|
97
|
+
const verdict = reachVerdict(channels);
|
|
98
|
+
if (verdict.kind === "yours" && (push.app > 0 || channels.yours === null || channels.site?.otherMembers === 0)) {
|
|
99
|
+
return { kind: "delivered", recipients: push.total, deviceLabel: describeRecipients(push, channels) };
|
|
100
|
+
}
|
|
101
|
+
if (verdict.kind === "unattributable") {
|
|
102
|
+
return { kind: "unattributable", recipients: push.total, otherMembers: verdict.otherMembers };
|
|
103
|
+
}
|
|
104
|
+
if (verdict.kind === "others") {
|
|
105
|
+
return { kind: "others-only", recipients: push.total, otherMembers: verdict.otherMembers };
|
|
106
|
+
}
|
|
107
|
+
if (verdict.kind === "yours") {
|
|
108
|
+
const otherMembers = channels.site?.otherMembers ?? 0;
|
|
109
|
+
return { kind: "unattributable", recipients: push.total, otherMembers };
|
|
110
|
+
}
|
|
111
|
+
return { kind: "delivered", recipients: push.total, deviceLabel: describeRecipients(push, channels) };
|
|
112
|
+
};
|
|
113
|
+
var sendTestNotification = async (apiKey) => {
|
|
114
|
+
const result = await callMcpTool(apiKey, "send_notification", {
|
|
115
|
+
title: "Pushary is connected",
|
|
116
|
+
body: "This setup notification reached you. Agent hooks still need a real-agent check.",
|
|
117
|
+
agentName: SETUP_AGENT_NAME
|
|
118
|
+
}, { timeoutMs: 2e4 });
|
|
119
|
+
const toCount = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
120
|
+
const app = toCount(result.delivery?.mobile?.recipients);
|
|
121
|
+
const web = toCount(result.delivery?.web?.recipients);
|
|
122
|
+
return { app, web, total: typeof result.sent === "number" ? result.sent : app + web };
|
|
123
|
+
};
|
|
124
|
+
var verifyDelivery = async (apiKey, channels, deps = {}) => {
|
|
125
|
+
const send = deps.send ?? sendTestNotification;
|
|
126
|
+
try {
|
|
127
|
+
return classifyDelivery(channels, await send(apiKey));
|
|
128
|
+
} catch (err) {
|
|
129
|
+
return { kind: "error", detail: err instanceof Error ? err.message : "send failed" };
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
var describeVerifyOutcome = (outcome) => {
|
|
133
|
+
switch (outcome.kind) {
|
|
134
|
+
case "delivered":
|
|
135
|
+
return { ok: true, message: `Delivered to ${outcome.deviceLabel}. Push works.`, next: [] };
|
|
136
|
+
case "no-recipients":
|
|
137
|
+
return {
|
|
138
|
+
ok: false,
|
|
139
|
+
message: "Nothing to deliver to. Agents are configured; approvals will fall back to the terminal.",
|
|
140
|
+
next: [
|
|
141
|
+
"Run pushary pair to pair your phone.",
|
|
142
|
+
"Then pushary doctor --roundtrip to test a synthetic question and answer."
|
|
143
|
+
]
|
|
144
|
+
};
|
|
145
|
+
case "others-only":
|
|
146
|
+
return {
|
|
147
|
+
ok: false,
|
|
148
|
+
message: `Delivered to ${plural2(outcome.recipients, "device")} on this site, none of them yours.`,
|
|
149
|
+
next: [
|
|
150
|
+
`Approvals for your agent would wake one of your ${plural2(outcome.otherMembers, "teammate")}.`,
|
|
151
|
+
"Run pushary pair to pair your own phone."
|
|
152
|
+
]
|
|
153
|
+
};
|
|
154
|
+
case "unattributable":
|
|
155
|
+
return {
|
|
156
|
+
ok: false,
|
|
157
|
+
message: `Delivered to ${plural2(outcome.recipients, "device")} on this site, and no way to tell whose.`,
|
|
158
|
+
next: [
|
|
159
|
+
"Browser subscriptions carry no owner, and this site has other members.",
|
|
160
|
+
"Install the Pushary app and pair it with pushary pair, or run pushary doctor --roundtrip to prove it reaches you."
|
|
161
|
+
]
|
|
162
|
+
};
|
|
163
|
+
case "error":
|
|
164
|
+
return {
|
|
165
|
+
ok: false,
|
|
166
|
+
message: `Could not send the test notification (${outcome.detail}).`,
|
|
167
|
+
next: ["Agents are configured. Run pushary doctor once the connection is back."]
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
var ROUND_TRIP_QUESTION = "Pushary delivery test. Answer either way to test returning an answer. This does not test your agent hooks.";
|
|
172
|
+
var ROUND_TRIP_TIMEOUT_MS = 55e3;
|
|
173
|
+
var reportNoInterrupt = async () => {
|
|
174
|
+
};
|
|
175
|
+
var defaultAsk = (apiKey, agentName) => (
|
|
176
|
+
// wait:false so the poll is ours: the blocking form returns on the SITE's
|
|
177
|
+
// policy timeout, which a user may have set to seconds, and a setup check
|
|
178
|
+
// reporting "unanswered" after three seconds would be a lie about the product.
|
|
179
|
+
callMcpTool(apiKey, "ask_user", {
|
|
180
|
+
question: ROUND_TRIP_QUESTION,
|
|
181
|
+
type: "confirm",
|
|
182
|
+
agentName,
|
|
183
|
+
wait: false
|
|
184
|
+
}, { timeoutMs: 15e3 })
|
|
185
|
+
);
|
|
186
|
+
var defaultWait = (apiKey, correlationId) => callMcpTool(apiKey, "wait_for_answer", {
|
|
187
|
+
correlationId,
|
|
188
|
+
timeoutMs: ROUND_TRIP_TIMEOUT_MS
|
|
189
|
+
}, { timeoutMs: ROUND_TRIP_TIMEOUT_MS + 5e3 });
|
|
190
|
+
var defaultCancel = async (apiKey, correlationId) => {
|
|
191
|
+
await callMcpTool(apiKey, "cancel_question", { correlationId }, { timeoutMs: 1e4 }).catch(() => {
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
var answeredRoundTrip = (answer, correlationId, latencyMs) => {
|
|
195
|
+
if (answer.value === void 0 || classifyConfirmResponse(answer.value) === null) {
|
|
196
|
+
return { kind: "error", detail: "the server reported an answer without a valid Yes, No or defer value" };
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
kind: "answered",
|
|
200
|
+
value: answer.value,
|
|
201
|
+
latencyMs,
|
|
202
|
+
correlationId,
|
|
203
|
+
...isAnswerSource(answer.answerSource) ? { answerSource: answer.answerSource } : {}
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
var verifyRoundTrip = async (apiKey, agentName = SETUP_AGENT_NAME, deps = {}) => {
|
|
207
|
+
const ask = deps.ask ?? defaultAsk;
|
|
208
|
+
const wait = deps.wait ?? defaultWait;
|
|
209
|
+
const cancel = deps.cancel ?? defaultCancel;
|
|
210
|
+
const interrupted = deps.interrupted ?? reportNoInterrupt;
|
|
211
|
+
const now = deps.now ?? Date.now;
|
|
212
|
+
const started = now();
|
|
213
|
+
let asked;
|
|
214
|
+
try {
|
|
215
|
+
asked = await ask(apiKey, agentName);
|
|
216
|
+
} catch (err) {
|
|
217
|
+
return { kind: "error", detail: err instanceof Error ? err.message : "ask failed" };
|
|
218
|
+
}
|
|
219
|
+
let shutdown;
|
|
220
|
+
const stop = (code) => {
|
|
221
|
+
if (shutdown) return;
|
|
222
|
+
shutdown = (async () => {
|
|
223
|
+
let timer;
|
|
224
|
+
try {
|
|
225
|
+
await Promise.race([
|
|
226
|
+
Promise.all([
|
|
227
|
+
cancel(apiKey, asked.correlationId).catch(() => {
|
|
228
|
+
}),
|
|
229
|
+
interrupted(code).catch(() => {
|
|
230
|
+
})
|
|
231
|
+
]),
|
|
232
|
+
new Promise((resolve) => {
|
|
233
|
+
timer = setTimeout(resolve, 4e3);
|
|
234
|
+
})
|
|
235
|
+
]);
|
|
236
|
+
} finally {
|
|
237
|
+
clearTimeout(timer);
|
|
238
|
+
process.stderr.write("Delivery test interrupted. Cleanup was attempted; an unresolved question expires automatically.\n");
|
|
239
|
+
process.exit(code);
|
|
240
|
+
}
|
|
241
|
+
})();
|
|
242
|
+
};
|
|
243
|
+
const onInterrupt = () => stop(130);
|
|
244
|
+
const onTerminate = () => stop(143);
|
|
245
|
+
if (asked.correlationId) {
|
|
246
|
+
process.on("SIGINT", onInterrupt);
|
|
247
|
+
process.on("SIGTERM", onTerminate);
|
|
248
|
+
}
|
|
249
|
+
let answerObserved = false;
|
|
250
|
+
try {
|
|
251
|
+
if (asked.noDevices || asked.warning) return { kind: "no-recipients" };
|
|
252
|
+
if (asked.mode === "notify_only" || asked.status === "notified") return { kind: "notify-only" };
|
|
253
|
+
if (!asked.correlationId) return { kind: "error", detail: "no correlationId returned" };
|
|
254
|
+
const answer = asked.answered === true ? asked : await wait(apiKey, asked.correlationId);
|
|
255
|
+
if (answer.answered === true) {
|
|
256
|
+
const outcome = answeredRoundTrip(answer, asked.correlationId, now() - started);
|
|
257
|
+
answerObserved = outcome.kind === "answered";
|
|
258
|
+
return outcome;
|
|
259
|
+
}
|
|
260
|
+
return { kind: "unanswered" };
|
|
261
|
+
} catch (err) {
|
|
262
|
+
return { kind: "error", detail: err instanceof Error ? err.message : "wait failed" };
|
|
263
|
+
} finally {
|
|
264
|
+
if (shutdown) await shutdown;
|
|
265
|
+
process.off("SIGINT", onInterrupt);
|
|
266
|
+
process.off("SIGTERM", onTerminate);
|
|
267
|
+
if (!answerObserved && asked.correlationId) await cancel(apiKey, asked.correlationId).catch(() => {
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
var describeAnswerSource = (source) => {
|
|
272
|
+
switch (source) {
|
|
273
|
+
case "mobile_app":
|
|
274
|
+
case "mobile_background":
|
|
275
|
+
return "Answered on your phone.";
|
|
276
|
+
case "mac_app":
|
|
277
|
+
return "Answered on your Mac.";
|
|
278
|
+
case "sandbox":
|
|
279
|
+
return "This was a simulated sandbox answer.";
|
|
280
|
+
default:
|
|
281
|
+
return source ? `Answer source: ${source}. This was a synthetic test.` : "The answering surface was not reported. This was a synthetic test.";
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
var NOTIFICATION_ANSWER_STEPS = /* @__PURE__ */ new Map([
|
|
285
|
+
["ios", "Press and hold the notification, then tap Approve."],
|
|
286
|
+
["android", "Expand the notification, then tap Approve."]
|
|
287
|
+
]);
|
|
288
|
+
var EITHER_PHONE_ANSWER_STEP = "Press and hold the notification on iPhone, or expand it on Android, then tap Approve.";
|
|
289
|
+
var notificationAnswerStep = (appPlatforms) => {
|
|
290
|
+
const platforms = [...new Set(appPlatforms)];
|
|
291
|
+
const [onlyPlatform] = platforms;
|
|
292
|
+
if (onlyPlatform === void 0) return null;
|
|
293
|
+
if (platforms.length > 1) return EITHER_PHONE_ANSWER_STEP;
|
|
294
|
+
return NOTIFICATION_ANSWER_STEPS.get(onlyPlatform) ?? EITHER_PHONE_ANSWER_STEP;
|
|
295
|
+
};
|
|
296
|
+
var WAITING_FOR_TAP = "Waiting for you to tap the notification";
|
|
297
|
+
var WAITING_FOR_ANSWER = "Waiting for your answer";
|
|
298
|
+
var describeAnswerTestPrompt = (appPlatforms) => {
|
|
299
|
+
const step = notificationAnswerStep(appPlatforms);
|
|
300
|
+
return { step, waiting: step === null ? WAITING_FOR_TAP : WAITING_FOR_ANSWER };
|
|
301
|
+
};
|
|
302
|
+
var CHECK_THE_NOTIFICATION_OPENED = "Check the notification actually opened something you could tap, then run pushary doctor --roundtrip.";
|
|
303
|
+
var unansweredNextStep = (appPlatforms) => {
|
|
304
|
+
const step = notificationAnswerStep(appPlatforms);
|
|
305
|
+
return step === null ? CHECK_THE_NOTIFICATION_OPENED : `To send another one, run pushary doctor --roundtrip. ${step}`;
|
|
306
|
+
};
|
|
307
|
+
var describeRoundTripOutcome = (outcome, appPlatforms = []) => {
|
|
308
|
+
switch (outcome.kind) {
|
|
309
|
+
case "answered":
|
|
310
|
+
return {
|
|
311
|
+
ok: true,
|
|
312
|
+
message: `Answered "${outcome.value}" in ${(outcome.latencyMs / 1e3).toFixed(1)}s. ${describeAnswerSource(outcome.answerSource)}`,
|
|
313
|
+
next: []
|
|
314
|
+
};
|
|
315
|
+
case "unanswered":
|
|
316
|
+
return {
|
|
317
|
+
ok: false,
|
|
318
|
+
message: "The question was sent and nothing came back.",
|
|
319
|
+
next: [
|
|
320
|
+
"A push that arrives and cannot be answered is the most common way this breaks, so this is worth resolving now.",
|
|
321
|
+
unansweredNextStep(appPlatforms)
|
|
322
|
+
]
|
|
323
|
+
};
|
|
324
|
+
case "notify-only":
|
|
325
|
+
return {
|
|
326
|
+
ok: true,
|
|
327
|
+
message: "Sent. This site is in notify-only mode, so questions never wait for an answer.",
|
|
328
|
+
next: ["Switch with pushary mode push_first if you want approvals to hold for your phone."]
|
|
329
|
+
};
|
|
330
|
+
case "no-recipients":
|
|
331
|
+
return {
|
|
332
|
+
ok: false,
|
|
333
|
+
message: "Nothing to ask. No phone or browser is connected to this site.",
|
|
334
|
+
next: [
|
|
335
|
+
"Run pushary pair to pair your phone.",
|
|
336
|
+
"Or pushary pair --app if you already have the Pushary app."
|
|
337
|
+
]
|
|
338
|
+
};
|
|
339
|
+
case "error":
|
|
340
|
+
return {
|
|
341
|
+
ok: false,
|
|
342
|
+
message: `Could not complete the round trip (${outcome.detail}).`,
|
|
343
|
+
next: ["Agents are configured. Run pushary doctor --roundtrip once the connection is back."]
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
var describeRoundTrip = (outcome, appPlatforms = []) => {
|
|
348
|
+
const report = describeRoundTripOutcome(outcome, appPlatforms);
|
|
349
|
+
return { ...report, next: [...report.next, "Agent hook activation remains unverified. Restart your agent and check one real approval."] };
|
|
350
|
+
};
|
|
351
|
+
var roundTripEvidence = (outcome) => ({
|
|
352
|
+
kind: outcome?.kind ?? "skipped",
|
|
353
|
+
...outcome?.kind === "answered" ? {
|
|
354
|
+
correlationId: outcome.correlationId ?? null,
|
|
355
|
+
answerSource: outcome.answerSource ?? null,
|
|
356
|
+
value: outcome.value,
|
|
357
|
+
latencyMs: outcome.latencyMs
|
|
358
|
+
} : {},
|
|
359
|
+
hookActivation: "unverified"
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
export {
|
|
363
|
+
reachVerdict,
|
|
364
|
+
reachesYou,
|
|
365
|
+
describeReach,
|
|
366
|
+
describeAppRepair,
|
|
367
|
+
describeJustPairedRepair,
|
|
368
|
+
SETUP_AGENT_NAME,
|
|
369
|
+
ownAppPlatforms,
|
|
370
|
+
verifyDelivery,
|
|
371
|
+
describeVerifyOutcome,
|
|
372
|
+
verifyRoundTrip,
|
|
373
|
+
notificationAnswerStep,
|
|
374
|
+
describeAnswerTestPrompt,
|
|
375
|
+
describeRoundTripOutcome,
|
|
376
|
+
describeRoundTrip,
|
|
377
|
+
roundTripEvidence
|
|
378
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SubscriptionRequiredError,
|
|
3
3
|
callMcpTool
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZL3UR6M5.js";
|
|
5
5
|
import {
|
|
6
6
|
CLIENT_REPORT_DISABLE_ENV,
|
|
7
7
|
isDisabledByEnv
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
installNetworkDefaults,
|
|
11
11
|
isNetworkFailure
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-5DZHKNBU.js";
|
|
13
13
|
import {
|
|
14
14
|
clientReportClaims
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MYBCXDIL.js";
|
|
16
16
|
import {
|
|
17
17
|
getApiKey,
|
|
18
18
|
getBaseUrl
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-LVDC3RUE.js";
|
|
20
20
|
import {
|
|
21
21
|
ASK_AGENT_NAME_MAX,
|
|
22
22
|
CLIENT_REPORT_PATH,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
GATE_PERMISSION_MODE_MAX_LENGTH,
|
|
25
25
|
degradedLine,
|
|
26
26
|
truncateLine
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-GZL3KEPC.js";
|
|
28
28
|
|
|
29
29
|
// src/api.ts
|
|
30
30
|
import { randomUUID } from "crypto";
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import {
|
|
2
|
+
notificationAnswerStep
|
|
3
|
+
} from "./chunk-CZULJ647.js";
|
|
4
|
+
import {
|
|
5
|
+
matchMacAccountStep,
|
|
6
|
+
retryAgentCommand
|
|
7
|
+
} from "./chunk-HUWLEVL2.js";
|
|
8
|
+
import {
|
|
9
|
+
EXIT
|
|
10
|
+
} from "./chunk-KZERVKTD.js";
|
|
11
|
+
import {
|
|
12
|
+
NPX_LATEST_COMMAND
|
|
13
|
+
} from "./chunk-5SFM6XB4.js";
|
|
14
|
+
|
|
15
|
+
// src/setup/closing.ts
|
|
16
|
+
var ACTIVITY_URL = "pushary.com/dashboard/agent/activity";
|
|
17
|
+
var CHECK_THE_NOTIFICATION_OPENED = "Check the notification opened something you could tap, then:";
|
|
18
|
+
var SEND_ANOTHER_TEST = "pushary doctor --roundtrip send another one";
|
|
19
|
+
var sendAnotherTestLines = (appPlatforms) => {
|
|
20
|
+
const step = notificationAnswerStep(appPlatforms);
|
|
21
|
+
return step === null ? [CHECK_THE_NOTIFICATION_OPENED, SEND_ANOTHER_TEST] : [SEND_ANOTHER_TEST, step];
|
|
22
|
+
};
|
|
23
|
+
var TRANSCRIPT_SYNC_NOTICE = `Transcripts sync redacted and encrypted. Your phone can decrypt them; authorized Pushary compliance admins can recover them for documented legal obligations. Turn off: ${NPX_LATEST_COMMAND} setup --transcripts off`;
|
|
24
|
+
var PAIR_PHONE_APP_HINT = `${NPX_LATEST_COMMAND} setup --connect app pair the Pushary app on your phone`;
|
|
25
|
+
var RESTART_AGENTS_LINE = "Restart any open agent sessions so they pick up Pushary.";
|
|
26
|
+
var ANSWERING_DEVICES = {
|
|
27
|
+
mobile_app: "Your phone",
|
|
28
|
+
mobile_background: "Your phone",
|
|
29
|
+
mac_app: "Your Mac"
|
|
30
|
+
};
|
|
31
|
+
var SIMULATED_ANSWER_HEADLINE = "Agents configured. The test answer was simulated.";
|
|
32
|
+
var answerSeconds = (latencyMs) => Math.max(1, Math.round(latencyMs / 1e3));
|
|
33
|
+
var describeAnsweredHeadline = (answer) => {
|
|
34
|
+
if (!answer) return "You're set. The test question was answered.";
|
|
35
|
+
if (answer.answerSource === "sandbox") return SIMULATED_ANSWER_HEADLINE;
|
|
36
|
+
const device = answer.answerSource ? ANSWERING_DEVICES[answer.answerSource] : void 0;
|
|
37
|
+
const seconds = answerSeconds(answer.latencyMs);
|
|
38
|
+
return device ? `You're set. ${device} answered in ${seconds}s.` : `You're set. The test question was answered in ${seconds}s.`;
|
|
39
|
+
};
|
|
40
|
+
var COMMAND_SURFACE = [
|
|
41
|
+
{ command: "pushary status", summary: "what this machine is connected to" },
|
|
42
|
+
{ command: "pushary mode", summary: "choose where approval requests appear" },
|
|
43
|
+
{ command: "pushary wait", summary: "show or set how long approvals wait for your phone" },
|
|
44
|
+
{ command: "pushary stats", summary: "what your agents have been asking" },
|
|
45
|
+
{ command: "pushary claude", summary: "run Claude Code with encrypted transcript support" },
|
|
46
|
+
{ command: "pushary doctor", summary: "check the install" }
|
|
47
|
+
];
|
|
48
|
+
var SURFACE_COLUMN = Math.max(...COMMAND_SURFACE.map((entry) => entry.command.length)) + 2;
|
|
49
|
+
var renderCommandSurface = () => COMMAND_SURFACE.map((entry) => `${entry.command.padEnd(SURFACE_COLUMN)}${entry.summary}`);
|
|
50
|
+
var PHONE_START_VERIFIED_LINE = "Phone-start and steering: local and server checks passed just now. Recheck after sleep or network changes.";
|
|
51
|
+
var PHONE_START_UNVERIFIED_LINE = "Phone-start and steering: unverified. Run pushary doctor to check the provider, background service and server route.";
|
|
52
|
+
var PHONE_START_FELL_SHORT_LINES = {
|
|
53
|
+
not_running: "Phone-start and steering: not running on this computer. Approvals do not depend on it. Run pushary doctor to see what is missing.",
|
|
54
|
+
running_unverified: "Phone-start and steering: the background service is running, but this run could not verify it. Approvals do not depend on it. Run pushary doctor to check it.",
|
|
55
|
+
could_not_be_removed: "Phone-start and steering: the background service could not be stopped or removed. Approvals do not depend on it. Run pushary doctor to see its state."
|
|
56
|
+
};
|
|
57
|
+
var phoneStartFellShortLine = (service) => PHONE_START_FELL_SHORT_LINES[service];
|
|
58
|
+
var phoneStartServiceState = (reading) => {
|
|
59
|
+
if (reading.lifecycleFailed) return "could_not_be_removed";
|
|
60
|
+
return reading.serviceIsRunning ? "running_unverified" : "not_running";
|
|
61
|
+
};
|
|
62
|
+
var phoneStartStatusLine = (facts) => {
|
|
63
|
+
if (facts.managedControlReady === true) return PHONE_START_VERIFIED_LINE;
|
|
64
|
+
if (facts.daemonReady === false) return phoneStartFellShortLine(facts.phoneStartService ?? "not_running");
|
|
65
|
+
return PHONE_START_UNVERIFIED_LINE;
|
|
66
|
+
};
|
|
67
|
+
var phoneStartFailedTheRun = (facts) => facts.daemonReady === false && facts.phoneStartRequired !== false;
|
|
68
|
+
var PHONE_START_UNVERIFIED_STEPS = [
|
|
69
|
+
"Agent configuration and managed control are separate. Phone-start and steering could not be verified.",
|
|
70
|
+
"pushary daemon install install or repair the background service",
|
|
71
|
+
"pushary doctor verify it became reachable"
|
|
72
|
+
];
|
|
73
|
+
var PHONE_START_CANNOT_RUN_LINE = "Agent configuration and managed control are separate. Phone-start cannot run on this computer yet; approvals do not depend on it.";
|
|
74
|
+
var STOP_REQUIRING_PHONE_START_STEP = `${NPX_LATEST_COMMAND} setup --control off stop requiring phone-start on this computer`;
|
|
75
|
+
var WHAT_PHONE_START_NEEDS = {
|
|
76
|
+
provider: [
|
|
77
|
+
"It needs Claude Code, Codex or Gemini CLI set up here with a command it can start, and setup found none.",
|
|
78
|
+
"It looks for claude, codex and gemini on PATH and in npm's global folder, and for claude in Claude Code's own install folder too.",
|
|
79
|
+
"Install one, or open a terminal where it runs, then run setup again."
|
|
80
|
+
],
|
|
81
|
+
"service-manager": [
|
|
82
|
+
"It needs a background service manager (launchd, systemd --user or Windows Task Scheduler), and this session has none.",
|
|
83
|
+
"Run setup again from a normal desktop session."
|
|
84
|
+
]
|
|
85
|
+
};
|
|
86
|
+
var PHONE_START_NOT_REMOVED_STEPS = [
|
|
87
|
+
PHONE_START_FELL_SHORT_LINES.could_not_be_removed,
|
|
88
|
+
"pushary doctor see what state it is in"
|
|
89
|
+
];
|
|
90
|
+
var phoneStartProblemSteps = (facts) => {
|
|
91
|
+
if (facts.phoneStartService === "could_not_be_removed") return PHONE_START_NOT_REMOVED_STEPS;
|
|
92
|
+
const missing = facts.phoneStartMissingPrerequisite;
|
|
93
|
+
return missing ? [PHONE_START_CANNOT_RUN_LINE, ...WHAT_PHONE_START_NEEDS[missing], STOP_REQUIRING_PHONE_START_STEP] : PHONE_START_UNVERIFIED_STEPS;
|
|
94
|
+
};
|
|
95
|
+
var nextSteps = (facts, reachable) => {
|
|
96
|
+
const lines = ["Delivery follows the current approval mode, recipient rules and presence. pushary mode status shows the workspace setting.", phoneStartStatusLine(facts)];
|
|
97
|
+
lines.push("Before stepping away, run pushary wait to see how long phone approvals wait and what happens if you do not answer.");
|
|
98
|
+
if (facts.staleEnvironmentKey) {
|
|
99
|
+
lines.push("Open a new terminal or unset PUSHARY_API_KEY, then run pushary doctor before starting an agent.");
|
|
100
|
+
}
|
|
101
|
+
if (facts.transcriptSync === false) {
|
|
102
|
+
lines.push("Transcripts: disabled on this machine.");
|
|
103
|
+
lines.push("pushary setup --transcripts on enable encrypted transcript sync");
|
|
104
|
+
} else {
|
|
105
|
+
lines.push(TRANSCRIPT_SYNC_NOTICE);
|
|
106
|
+
}
|
|
107
|
+
if (facts.completed.includes("claude_code")) {
|
|
108
|
+
lines.push("pushary claude launch a managed Claude Code session");
|
|
109
|
+
}
|
|
110
|
+
if (!reachable) {
|
|
111
|
+
lines.push(PAIR_PHONE_APP_HINT);
|
|
112
|
+
}
|
|
113
|
+
lines.push("pushary doctor re-check everything");
|
|
114
|
+
return lines;
|
|
115
|
+
};
|
|
116
|
+
var describeClosing = (facts) => {
|
|
117
|
+
const reachable = facts.reachChecked && facts.reachesYou;
|
|
118
|
+
if (facts.configuredNothing) {
|
|
119
|
+
return {
|
|
120
|
+
ok: false,
|
|
121
|
+
headline: "Setup failed.",
|
|
122
|
+
next: ["Nothing was configured. Run pushary doctor to see why."],
|
|
123
|
+
exitCode: EXIT.FAILED,
|
|
124
|
+
reason: "configured-nothing"
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (facts.failed.length > 0) {
|
|
128
|
+
const count = facts.failed.length;
|
|
129
|
+
return {
|
|
130
|
+
ok: false,
|
|
131
|
+
headline: `Setup finished with ${count} problem${count === 1 ? "" : "s"}.`,
|
|
132
|
+
next: [
|
|
133
|
+
...nextSteps(facts, reachable),
|
|
134
|
+
"For support: pushary doctor --bundle creates a redacted diagnostic with the last setup failure. Review it before sharing.",
|
|
135
|
+
"",
|
|
136
|
+
`Approvals: ${ACTIVITY_URL}`
|
|
137
|
+
],
|
|
138
|
+
exitCode: EXIT.PROBLEMS_FOUND,
|
|
139
|
+
reason: "agents-failed"
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
if (facts.staleEnvironmentKey) {
|
|
143
|
+
return {
|
|
144
|
+
ok: false,
|
|
145
|
+
headline: "Agents configured. This terminal still selects the previous key.",
|
|
146
|
+
next: nextSteps(facts, reachable),
|
|
147
|
+
exitCode: EXIT.PROBLEMS_FOUND,
|
|
148
|
+
reason: "stale-environment-key"
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
if (phoneStartFailedTheRun(facts)) {
|
|
152
|
+
return {
|
|
153
|
+
ok: false,
|
|
154
|
+
headline: "Setup finished with 1 problem.",
|
|
155
|
+
next: phoneStartProblemSteps(facts),
|
|
156
|
+
exitCode: EXIT.PROBLEMS_FOUND,
|
|
157
|
+
reason: "control-unready"
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
if (facts.roundTripAnswered === true) {
|
|
161
|
+
return {
|
|
162
|
+
ok: true,
|
|
163
|
+
headline: describeAnsweredHeadline(facts.roundTripAnswer),
|
|
164
|
+
next: [RESTART_AGENTS_LINE, ...nextSteps(facts, reachable), "", `Approvals: ${ACTIVITY_URL}`],
|
|
165
|
+
exitCode: EXIT.OK,
|
|
166
|
+
reason: "synthetic-answer"
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
if (facts.reachChecked && !facts.reachesYou) {
|
|
170
|
+
return {
|
|
171
|
+
ok: false,
|
|
172
|
+
headline: "Agents configured. Phone delivery is unverified.",
|
|
173
|
+
next: [
|
|
174
|
+
"Your agent configuration is saved. Once your phone is connected, run pushary doctor --roundtrip to finish verification without reinstalling.",
|
|
175
|
+
"Approval routing depends on your mode, presence and recipients. Check the phone and its notification settings.",
|
|
176
|
+
"",
|
|
177
|
+
...nextSteps(facts, false)
|
|
178
|
+
],
|
|
179
|
+
exitCode: EXIT.NO_DEVICE,
|
|
180
|
+
reason: "phone-unverified"
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (facts.roundTripAnswered === false) {
|
|
184
|
+
return {
|
|
185
|
+
ok: false,
|
|
186
|
+
headline: "Agents configured. Nobody answered the test question.",
|
|
187
|
+
next: [
|
|
188
|
+
"No answer returned from the synthetic test. Delivery acceptance does not prove a visible notification.",
|
|
189
|
+
"",
|
|
190
|
+
...sendAnotherTestLines(facts.appPlatforms ?? []),
|
|
191
|
+
"",
|
|
192
|
+
"If you simply were not looking, re-run setup or pass --verify push to skip this check."
|
|
193
|
+
],
|
|
194
|
+
exitCode: EXIT.PROBLEMS_FOUND,
|
|
195
|
+
reason: "roundtrip-unanswered"
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
if (!facts.reachChecked) {
|
|
199
|
+
return {
|
|
200
|
+
ok: true,
|
|
201
|
+
headline: "Setup complete.",
|
|
202
|
+
next: [
|
|
203
|
+
"The phone check was skipped, so nothing here proves an approval reaches you.",
|
|
204
|
+
"",
|
|
205
|
+
...nextSteps(facts, false)
|
|
206
|
+
],
|
|
207
|
+
exitCode: EXIT.OK,
|
|
208
|
+
reason: "phone-skipped"
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
ok: true,
|
|
213
|
+
headline: "Setup complete.",
|
|
214
|
+
next: [...nextSteps(facts, true), "", `Approvals: ${ACTIVITY_URL}`],
|
|
215
|
+
exitCode: EXIT.OK,
|
|
216
|
+
reason: "complete"
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
var RETRY_AGENT_LABEL = "Retry just this agent:";
|
|
220
|
+
var INSTALL_NODE_STEP = "Install the current Node.js LTS, which includes npm, then run setup again.";
|
|
221
|
+
var NPM_PREFIX_STEP = "npm can't install globally here. Use nvm, or run: npm config set prefix ~/.npm-global, then run setup again.";
|
|
222
|
+
var NPM_FILE_IN_USE_STEP = "Close other terminals or editors that use Node, then run setup again.";
|
|
223
|
+
var nextStepFor = (failure) => {
|
|
224
|
+
switch (failure.remedy) {
|
|
225
|
+
case "install-node":
|
|
226
|
+
return { kind: "install-node", instruction: INSTALL_NODE_STEP };
|
|
227
|
+
case "fix-npm-prefix":
|
|
228
|
+
return { kind: "fix-npm-prefix", instruction: NPM_PREFIX_STEP };
|
|
229
|
+
case "close-node-programs":
|
|
230
|
+
return { kind: "close-node-programs", instruction: NPM_FILE_IN_USE_STEP };
|
|
231
|
+
case "match-mac-account":
|
|
232
|
+
return { kind: "match-mac-account", instruction: matchMacAccountStep(failure.agent, null) };
|
|
233
|
+
case "retry-agent":
|
|
234
|
+
return { kind: "retry-agent", command: retryAgentCommand(failure.agent) };
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
var describeAgentFailures = (failures, agentName) => failures.map((failure) => ({
|
|
238
|
+
summary: `${agentName(failure.agent)}: ${failure.detail}`,
|
|
239
|
+
next: nextStepFor(failure)
|
|
240
|
+
}));
|
|
241
|
+
var agentFailureFollowUps = (failures) => [
|
|
242
|
+
...failures.some((failure) => failure.remedy === "install-node") ? ["install-node"] : [],
|
|
243
|
+
...failures.some((failure) => failure.remedy === "fix-npm-prefix") ? ["fix-npm-prefix"] : [],
|
|
244
|
+
...failures.some((failure) => failure.remedy === "close-node-programs") ? ["close-node-programs"] : [],
|
|
245
|
+
...failures.some((failure) => failure.remedy === "retry-agent") ? ["run-doctor"] : []
|
|
246
|
+
];
|
|
247
|
+
var unverifiedKeyClosingReason = (facts) => {
|
|
248
|
+
if (facts.failedCount > 0) return "agents-failed";
|
|
249
|
+
if (facts.controlLifecycleFailed) return "control-unready";
|
|
250
|
+
return facts.keyCheck === "locked" ? "plan-inactive" : "key-unverified";
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export {
|
|
254
|
+
TRANSCRIPT_SYNC_NOTICE,
|
|
255
|
+
renderCommandSurface,
|
|
256
|
+
phoneStartFellShortLine,
|
|
257
|
+
phoneStartServiceState,
|
|
258
|
+
describeClosing,
|
|
259
|
+
RETRY_AGENT_LABEL,
|
|
260
|
+
INSTALL_NODE_STEP,
|
|
261
|
+
NPM_PREFIX_STEP,
|
|
262
|
+
NPM_FILE_IN_USE_STEP,
|
|
263
|
+
describeAgentFailures,
|
|
264
|
+
agentFailureFollowUps,
|
|
265
|
+
unverifiedKeyClosingReason
|
|
266
|
+
};
|