pushary 1.9.177 → 1.9.179
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 +14 -0
- package/dist/{api-MOK62OPO.js → api-YH7WN4FA.js} +21 -11
- package/dist/bin/pushary-audit.js +3 -3
- package/dist/bin/pushary-bell-hook.js +28 -28
- package/dist/bin/pushary-bell.js +12 -12
- package/dist/bin/pushary-calls.js +15 -15
- package/dist/bin/pushary-claude.js +27 -27
- package/dist/bin/pushary-clean.js +38 -38
- package/dist/bin/pushary-codex-bridge.js +23 -23
- package/dist/bin/pushary-codex-hook.js +108 -54
- package/dist/bin/pushary-codex-session.js +8 -8
- package/dist/bin/pushary-codex.js +16 -16
- package/dist/bin/pushary-connect.js +34 -34
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +102 -78
- package/dist/bin/pushary-disconnect.js +29 -29
- package/dist/bin/pushary-display-hook.js +22 -1
- package/dist/bin/pushary-doctor.js +62 -48
- package/dist/bin/pushary-elicitation-hook.js +28 -28
- package/dist/bin/pushary-gemini-bridge.js +20 -33
- package/dist/bin/pushary-gemini-hook.js +32 -32
- package/dist/bin/pushary-hook.js +36 -36
- package/dist/bin/pushary-login.js +22 -22
- package/dist/bin/pushary-logout.js +29 -29
- package/dist/bin/pushary-mcp.js +12 -12
- package/dist/bin/pushary-mode.js +16 -16
- package/dist/bin/pushary-notification-hook.js +27 -27
- package/dist/bin/pushary-opencode-bridge.d.ts +1 -0
- package/dist/bin/pushary-opencode-bridge.js +576 -0
- package/dist/bin/pushary-opencode-hook.js +33 -33
- package/dist/bin/pushary-permission-denied-hook.js +36 -36
- package/dist/bin/pushary-permission-hook.js +36 -36
- package/dist/bin/pushary-post-hook.js +28 -28
- package/dist/bin/pushary-prompt-hook.js +27 -27
- package/dist/bin/pushary-session-end-hook.js +27 -27
- package/dist/bin/pushary-session-start-hook.js +38 -38
- package/dist/bin/pushary-sessions.js +14 -14
- package/dist/bin/pushary-setup.js +58 -58
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +35 -35
- package/dist/bin/pushary-stop-hook.js +27 -27
- package/dist/bin/pushary-stopfailure-hook.js +27 -27
- package/dist/bin/pushary-suggestions.js +16 -16
- package/dist/bin/pushary-transcript-register.js +17 -17
- package/dist/bin/pushary-transcripts.js +25 -25
- package/dist/bin/pushary-upgrade.js +45 -44
- package/dist/bin/pushary-wait.js +16 -16
- package/dist/bin/pushary.js +7 -7
- package/dist/{chunk-2SFXPVAE.js → chunk-2HMDWEER.js} +1 -1
- package/dist/{chunk-7ZDL4EOA.js → chunk-2JSTCD7L.js} +2 -2
- package/dist/{chunk-GOL7TCMO.js → chunk-32YARQJC.js} +5 -5
- package/dist/{chunk-2HREYLQL.js → chunk-3BZ7IGGW.js} +5 -5
- package/dist/{chunk-G2RTHSTU.js → chunk-3JXSIPLF.js} +1 -1
- package/dist/{chunk-N7GV4Y5B.js → chunk-3NTAU6DN.js} +2 -2
- package/dist/{chunk-BTOP6AHZ.js → chunk-65CSOPQW.js} +12 -25
- package/dist/{chunk-MNWUZ4JH.js → chunk-6BIC2SHE.js} +2 -2
- package/dist/{chunk-FLEDJCTE.js → chunk-6KF26UUL.js} +3 -3
- package/dist/{chunk-6FFXBHVF.js → chunk-6W7Q6VB6.js} +2 -2
- package/dist/{chunk-77PUYCLF.js → chunk-7VNTZY7V.js} +90 -21
- package/dist/{chunk-A4AG42X2.js → chunk-A7G6CFZU.js} +4 -4
- package/dist/{chunk-HCW3KFL3.js → chunk-AXPZZFBW.js} +2 -2
- package/dist/{chunk-AH6FRO37.js → chunk-AYMFOYOZ.js} +9 -9
- package/dist/{chunk-UC4DTMPM.js → chunk-AYP4GE3X.js} +24 -0
- package/dist/{chunk-SOWF5BU3.js → chunk-BKZZSXEQ.js} +4 -4
- package/dist/{chunk-2O6TO2YW.js → chunk-BNZYEIBB.js} +18 -18
- package/dist/{chunk-UYBCGHGQ.js → chunk-CTJRWP6Y.js} +3 -3
- package/dist/{chunk-3HGR5T4W.js → chunk-D7GUUTOT.js} +4 -4
- package/dist/{chunk-AIM5GLBI.js → chunk-E25IZ5S3.js} +4 -4
- package/dist/{chunk-5SNBTQOU.js → chunk-EEHTVBKI.js} +6 -6
- package/dist/{chunk-R2VQ4OKM.js → chunk-FHVGZ6AN.js} +1 -1
- package/dist/{chunk-MIHH354F.js → chunk-FWUF33U6.js} +2 -2
- package/dist/{chunk-XWG4PSQL.js → chunk-HGP2DDW3.js} +1 -1
- package/dist/{chunk-WVU5TTRU.js → chunk-HNQ2FIBA.js} +2 -2
- package/dist/{chunk-FUSZOEZK.js → chunk-HOVBZBAJ.js} +4 -4
- package/dist/{chunk-5OBLFHMG.js → chunk-I4XCADTT.js} +1 -1
- package/dist/{chunk-M7LXGZM6.js → chunk-I6AMLYXS.js} +4 -4
- package/dist/{chunk-NNWUE7PY.js → chunk-INUW2CXK.js} +6 -6
- package/dist/{chunk-2HK3KVEJ.js → chunk-IV4ZY2DS.js} +5 -5
- package/dist/{chunk-OU4FPSNZ.js → chunk-J5PTUQMF.js} +3 -3
- package/dist/{chunk-5YUBUJ6F.js → chunk-JDNQC5IG.js} +5 -5
- package/dist/{chunk-JH6IUXXS.js → chunk-JMPC7HL6.js} +6 -6
- package/dist/{chunk-JLOOLENK.js → chunk-JSSCR6M2.js} +2 -2
- package/dist/{chunk-KLPOTV4Q.js → chunk-KFLHGN4D.js} +3 -3
- package/dist/{chunk-KSRMVJ2V.js → chunk-KUB4OGLG.js} +5 -5
- package/dist/{chunk-3DFKZATL.js → chunk-M2P5KFP5.js} +3 -3
- package/dist/{chunk-AUVB3J6X.js → chunk-MIJ2P4FZ.js} +7 -7
- package/dist/{chunk-XJJ4KJF5.js → chunk-MKKRQBQF.js} +114 -15
- package/dist/{chunk-5F2GVH3H.js → chunk-MM5QO2ZY.js} +1 -1
- package/dist/{chunk-LAJ62ADY.js → chunk-MWKKUBHQ.js} +1 -1
- package/dist/{chunk-ZHVWYX5I.js → chunk-N24MKYZ2.js} +1 -1
- package/dist/{chunk-6HEYIMTE.js → chunk-N2L7E5NE.js} +5 -5
- package/dist/{chunk-IIIVVFHC.js → chunk-NEAJLLIG.js} +5 -5
- package/dist/{chunk-RQYNZJZ3.js → chunk-NX33EVEP.js} +1 -1
- package/dist/{chunk-GCAFTVYG.js → chunk-OD6JNTGZ.js} +2 -2
- package/dist/{chunk-QS4IPOAQ.js → chunk-OIFWZESQ.js} +14 -11
- package/dist/{chunk-4YBTCIIU.js → chunk-P3MYHWF5.js} +5 -5
- package/dist/{chunk-L3R3XAQC.js → chunk-PFH7XMHE.js} +1 -1
- package/dist/{chunk-HWBO3QVL.js → chunk-PJHYFHP4.js} +1 -1
- package/dist/{chunk-ZRMI7POM.js → chunk-POESL3CD.js} +1 -1
- package/dist/{chunk-2MMTYCCV.js → chunk-QMV7WS7D.js} +2 -2
- package/dist/{chunk-TIGCU3PF.js → chunk-QYGO5EKA.js} +2 -2
- package/dist/{chunk-3CWVK6BS.js → chunk-RM3F4V6A.js} +64 -15
- package/dist/{chunk-RSRWMXEM.js → chunk-RM3YENVK.js} +3 -3
- package/dist/{chunk-UOM2JOQZ.js → chunk-RVIYAQC7.js} +2 -2
- package/dist/{chunk-CUE6IPNE.js → chunk-S7X3PENP.js} +6 -6
- package/dist/{chunk-G2T7S5RU.js → chunk-SV6AMA7J.js} +10 -10
- package/dist/{chunk-DOCNSQOB.js → chunk-SYIAWMBA.js} +6 -6
- package/dist/{chunk-SV7PLR6Z.js → chunk-TVBND3VL.js} +2 -2
- package/dist/{chunk-CEMYK6BM.js → chunk-UJUXZCQS.js} +6 -6
- package/dist/{chunk-NWO4GVKC.js → chunk-VOWNWXVE.js} +38 -10
- package/dist/{chunk-4PRJDA3J.js → chunk-W27VNI6G.js} +1 -1
- package/dist/{chunk-IR5B5EQI.js → chunk-WDPIZXCZ.js} +3 -3
- package/dist/{chunk-KX2SWWSD.js → chunk-WII73NRE.js} +1 -1
- package/dist/{chunk-J3V4CBKZ.js → chunk-WIKPDEOR.js} +29 -8
- package/dist/{chunk-FDB2VMJM.js → chunk-WMHXZDUT.js} +2 -2
- package/dist/{chunk-NSR3ZTUJ.js → chunk-XJG7YRF7.js} +3 -3
- package/dist/{chunk-W7KAVPQP.js → chunk-XOVAERD7.js} +1 -1
- package/dist/{chunk-EXK47DWS.js → chunk-XQGU77H7.js} +4 -4
- package/dist/{chunk-DN5FNT3O.js → chunk-XWWD2KTY.js} +22 -1
- package/dist/{chunk-LGKFRWQL.js → chunk-Y5BRXPL6.js} +1 -1
- package/dist/{chunk-QBIALYLY.js → chunk-YRGDHBS5.js} +4 -4
- package/dist/{chunk-EHFUVDRM.js → chunk-YXLJTIGG.js} +4 -4
- package/dist/{chunk-MIRXACOR.js → chunk-Z2DAWG5U.js} +6 -1
- package/dist/{chunk-QES7CGHR.js → chunk-ZMJKA7CF.js} +5 -5
- package/dist/{chunk-VOPORKYP.js → chunk-ZMSQQVVY.js} +1 -1
- package/dist/{chunk-LEWVT2A2.js → chunk-ZNCRZNLJ.js} +1 -1
- package/dist/{chunk-JWMS3WIN.js → chunk-ZPHPNTGW.js} +1 -1
- package/dist/{chunk-L7MROSFJ.js → chunk-ZTNGM6NU.js} +3 -3
- package/dist/{codex-app-cards-switch-VUX7FUBE.js → codex-app-cards-switch-RDVTCDVO.js} +11 -11
- package/dist/{codex-card-routing-F6PBOHKA.js → codex-card-routing-XUYIRUB7.js} +2 -2
- package/dist/{codex-desktop-launch-DHE24VP2.js → codex-desktop-launch-EX3E3T3Q.js} +1 -1
- package/dist/{codex-session-launch-5QMO4UNL.js → codex-session-launch-TDEWJ3G6.js} +20 -20
- package/dist/{config-VEUG5WVO.js → config-XDZZTOHU.js} +3 -3
- package/dist/{global-upgrade-TE6N2LPD.js → global-upgrade-QVFP4F7D.js} +9 -9
- package/dist/{identity-RUUBB2GE.js → identity-Q5HWBCJY.js} +4 -4
- package/dist/{live-capabilities-CATPYBSX.js → live-capabilities-G5FB5VBL.js} +28 -4
- package/dist/{paths-LE4WLG45.js → paths-IVCUVJM6.js} +3 -3
- package/dist/{reapply-4BTKZGKT.js → reapply-MQTAPBPH.js} +31 -31
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +35 -35
- package/dist/{upgrade-lock-HU2F5X57.js → upgrade-lock-Y56NERM5.js} +4 -4
- package/dist/{usage-UMIDTEI3.js → usage-J7O2QQEQ.js} +3 -3
- package/package.json +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
realpath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2JSTCD7L.js";
|
|
4
4
|
import {
|
|
5
5
|
findNativeClaudeInstall
|
|
6
6
|
} from "./chunk-TCE3J44Z.js";
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
resolvePackageVersionFromBinary,
|
|
13
13
|
resolvePathBinary,
|
|
14
14
|
resolvePathBinaryAsync
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BKZZSXEQ.js";
|
|
16
16
|
import {
|
|
17
|
+
AGENTS,
|
|
17
18
|
CLAUDE_BRIDGE_CAPABILITY,
|
|
18
19
|
CLAUDE_RESUME_CAPABILITY,
|
|
19
20
|
CODEX_BRIDGE_CAPABILITY,
|
|
@@ -21,13 +22,16 @@ import {
|
|
|
21
22
|
GEMINI_BRIDGE_CAPABILITY,
|
|
22
23
|
GEMINI_RESUME_CAPABILITY,
|
|
23
24
|
MANAGED_PROVIDERS,
|
|
25
|
+
OPENCODE_BRIDGE_CAPABILITY,
|
|
24
26
|
SPAWN_CAPABILITY,
|
|
25
27
|
sessionProvidersAdvertisedBy
|
|
26
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-AYP4GE3X.js";
|
|
27
29
|
|
|
28
30
|
// src/live-capabilities.ts
|
|
31
|
+
import { execFileSync } from "child_process";
|
|
29
32
|
import { accessSync, constants, statSync as statSync2 } from "fs";
|
|
30
33
|
import { homedir } from "os";
|
|
34
|
+
import { join as join2 } from "path";
|
|
31
35
|
|
|
32
36
|
// src/setup/codex-install-probe.ts
|
|
33
37
|
import { existsSync, readdirSync, statSync } from "fs";
|
|
@@ -97,6 +101,11 @@ var codexInstallHealthAt = (binary) => checkCodexInstall(nodeCodexInstallProbe((
|
|
|
97
101
|
|
|
98
102
|
// src/live-capabilities.ts
|
|
99
103
|
var GEMINI_BRIDGE_MIN_VERSION = [0, 40, 0];
|
|
104
|
+
var OPENCODE_BRIDGE_MIN_MAJOR = 2;
|
|
105
|
+
var OPENCODE_PACKAGE = "opencode-ai";
|
|
106
|
+
var OPENCODE_VERSION_TIMEOUT_MS = 3e3;
|
|
107
|
+
var OPENCODE_VERSION_OUTPUT = /\bv?(\d+\.\d+\.\d+)\b/;
|
|
108
|
+
var OPENCODE_DESKTOP_CLI = "/Applications/OpenCode.app/Contents/Resources/opencode-cli";
|
|
100
109
|
var version = (raw) => {
|
|
101
110
|
const match = raw?.match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
102
111
|
return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
|
|
@@ -110,10 +119,16 @@ var geminiLiveCapabilities = (rawVersion) => {
|
|
|
110
119
|
}
|
|
111
120
|
return [GEMINI_BRIDGE_CAPABILITY, GEMINI_RESUME_CAPABILITY];
|
|
112
121
|
};
|
|
122
|
+
var openCodeLiveCapabilities = (rawVersion) => {
|
|
123
|
+
const installed = version(rawVersion);
|
|
124
|
+
return installed && installed[0] >= OPENCODE_BRIDGE_MIN_MAJOR ? [OPENCODE_BRIDGE_CAPABILITY] : [];
|
|
125
|
+
};
|
|
126
|
+
var openCodeVersionFromOutput = (output) => OPENCODE_VERSION_OUTPUT.exec(output)?.[1];
|
|
113
127
|
var providerLiveCapabilities = (probe) => [
|
|
114
128
|
...probe.claude ? [CLAUDE_BRIDGE_CAPABILITY, CLAUDE_RESUME_CAPABILITY] : [],
|
|
115
129
|
...probe.codex ? [CODEX_BRIDGE_CAPABILITY, CODEX_RESUME_CAPABILITY] : [],
|
|
116
|
-
...geminiLiveCapabilities(probe.geminiVersion)
|
|
130
|
+
...geminiLiveCapabilities(probe.geminiVersion),
|
|
131
|
+
...openCodeLiveCapabilities(probe.openCodeVersion)
|
|
117
132
|
];
|
|
118
133
|
var launchableProviders = sessionProvidersAdvertisedBy;
|
|
119
134
|
var hasSpawnProvider = (capabilities) => launchableProviders(capabilities).length > 0;
|
|
@@ -129,13 +144,89 @@ var missingControlPrerequisite = (input) => {
|
|
|
129
144
|
return null;
|
|
130
145
|
};
|
|
131
146
|
var WHAT_REQUIRED_PHONE_START_LACKS = {
|
|
132
|
-
provider: "install and configure a supported Claude Code, Codex or
|
|
147
|
+
provider: "install and configure a supported Claude Code, Codex, Gemini or OpenCode provider",
|
|
133
148
|
"service-manager": "no native background-service manager is available in this OS session"
|
|
134
149
|
};
|
|
135
150
|
var describeMissingControlPrerequisite = (missing) => WHAT_REQUIRED_PHONE_START_LACKS[missing];
|
|
136
151
|
var phoneStartIsRequired = (input) => input.mode === "on" || input.policy === "legacy" || input.lifecycleFailed;
|
|
152
|
+
var isManagedProvider = (value) => MANAGED_PROVIDERS.some((provider) => provider === value);
|
|
153
|
+
var MANAGED_PROVIDER_OF_AGENT = new Map(
|
|
154
|
+
Object.entries(AGENTS).flatMap(([agent, entry]) => entry.sessionRuntime ? [[agent, entry.sessionRuntime.provider]] : [])
|
|
155
|
+
);
|
|
156
|
+
var isManagedProviderAgent = (agent) => MANAGED_PROVIDER_OF_AGENT.has(agent);
|
|
157
|
+
var managedProvidersOfAgents = (agents) => agents.flatMap((agent) => {
|
|
158
|
+
const provider = MANAGED_PROVIDER_OF_AGENT.get(agent);
|
|
159
|
+
return provider ? [provider] : [];
|
|
160
|
+
});
|
|
161
|
+
var openCodeLaunchReadiness = (binary, reported) => {
|
|
162
|
+
if (!binary) return { kind: "missing" };
|
|
163
|
+
if (!reported || !version(reported)) return { kind: "unreadable", binary };
|
|
164
|
+
return openCodeLiveCapabilities(reported).length > 0 ? { kind: "ready", binary, version: reported } : { kind: "too_old", binary, version: reported };
|
|
165
|
+
};
|
|
166
|
+
var describeOpenCodeLaunchReadiness = (readiness) => {
|
|
167
|
+
switch (readiness.kind) {
|
|
168
|
+
case "ready":
|
|
169
|
+
return `OpenCode ${readiness.version} at ${readiness.binary}`;
|
|
170
|
+
case "missing":
|
|
171
|
+
return "no OpenCode program on PATH, in ~/.opencode/bin or in OpenCode.app";
|
|
172
|
+
case "unreadable":
|
|
173
|
+
return `could not read the version of ${readiness.binary}`;
|
|
174
|
+
case "too_old":
|
|
175
|
+
return `OpenCode ${readiness.version} at ${readiness.binary}; starting it from the phone needs OpenCode 2`;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
137
178
|
var preferGlobalProviderBinary = (platform) => platform === "win32";
|
|
138
|
-
var
|
|
179
|
+
var isExecutableFile = (path) => {
|
|
180
|
+
try {
|
|
181
|
+
accessSync(path, constants.X_OK);
|
|
182
|
+
return statSync2(path).isFile();
|
|
183
|
+
} catch {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
var openCodeInstallCandidates = (home, platform) => [
|
|
188
|
+
...platform === "win32" ? [] : [join2(home, ".opencode", "bin", "opencode")],
|
|
189
|
+
...platform === "darwin" ? [OPENCODE_DESKTOP_CLI] : []
|
|
190
|
+
];
|
|
191
|
+
var nativeInstallOf = (provider, platform, home) => {
|
|
192
|
+
if (provider === "claude") return findNativeClaudeInstall(home, platform);
|
|
193
|
+
if (provider === "opencode") return openCodeInstallCandidates(home, platform).find(isExecutableFile);
|
|
194
|
+
return void 0;
|
|
195
|
+
};
|
|
196
|
+
var FAILED_VERSION_CHECK_RETRY_MS = 5 * 6e4;
|
|
197
|
+
var reportedVersions = /* @__PURE__ */ new Map();
|
|
198
|
+
var rememberedVersionHolds = (remembered, stamp, at) => remembered?.stamp === stamp && (remembered.version !== void 0 || at - remembered.checkedAt < FAILED_VERSION_CHECK_RETRY_MS);
|
|
199
|
+
var fileStamp = (path) => {
|
|
200
|
+
try {
|
|
201
|
+
const stats = statSync2(path);
|
|
202
|
+
return `${stats.mtimeMs}:${stats.size}`;
|
|
203
|
+
} catch {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var versionOutputOf = (binary) => {
|
|
208
|
+
try {
|
|
209
|
+
return execFileSync(binary, ["--version"], {
|
|
210
|
+
encoding: "utf8",
|
|
211
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
212
|
+
timeout: OPENCODE_VERSION_TIMEOUT_MS,
|
|
213
|
+
windowsHide: true
|
|
214
|
+
});
|
|
215
|
+
} catch {
|
|
216
|
+
return "";
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
var readOpenCodeVersion = (binary, at = Date.now()) => {
|
|
220
|
+
const packaged = resolvePackageVersionFromBinary(binary, OPENCODE_PACKAGE);
|
|
221
|
+
if (packaged) return packaged;
|
|
222
|
+
const stamp = fileStamp(binary);
|
|
223
|
+
if (stamp === null) return void 0;
|
|
224
|
+
const remembered = reportedVersions.get(binary);
|
|
225
|
+
if (remembered && rememberedVersionHolds(remembered, stamp, at)) return remembered.version;
|
|
226
|
+
const reported = openCodeVersionFromOutput(versionOutputOf(binary));
|
|
227
|
+
reportedVersions.set(binary, { stamp, version: reported, checkedAt: at });
|
|
228
|
+
return reported;
|
|
229
|
+
};
|
|
139
230
|
var resolveProviderBinary = (provider, platform = process.platform, home = homedir()) => (preferGlobalProviderBinary(platform) ? resolveGlobalBinary(provider) ?? resolvePathBinary(provider, platform) : resolvePathBinary(provider, platform) ?? resolveGlobalBinary(provider)) ?? nativeInstallOf(provider, platform, home);
|
|
140
231
|
var codexBinaryIsBroken = (binary) => codexInstallHealthAt(binary).kind === "binary-missing";
|
|
141
232
|
var detectCapabilities = (providers, codexCanStart, home) => {
|
|
@@ -143,10 +234,12 @@ var detectCapabilities = (providers, codexCanStart, home) => {
|
|
|
143
234
|
const binaryFor = (provider) => enabled.has(provider) ? resolveProviderBinary(provider, process.platform, home) : void 0;
|
|
144
235
|
const codexBin = binaryFor("codex");
|
|
145
236
|
const geminiBin = binaryFor("gemini");
|
|
237
|
+
const openCodeBin = binaryFor("opencode");
|
|
146
238
|
return providerLiveCapabilities({
|
|
147
239
|
claude: binaryFor("claude") !== void 0,
|
|
148
240
|
codex: codexBin !== void 0 && codexCanStart(codexBin),
|
|
149
|
-
geminiVersion: geminiBin ? resolvePackageVersionFromBinary(geminiBin, "@google/gemini-cli") ?? resolveGlobalPackageVersion("@google/gemini-cli") : void 0
|
|
241
|
+
geminiVersion: geminiBin ? resolvePackageVersionFromBinary(geminiBin, "@google/gemini-cli") ?? resolveGlobalPackageVersion("@google/gemini-cli") : void 0,
|
|
242
|
+
openCodeVersion: openCodeBin ? readOpenCodeVersion(openCodeBin) : void 0
|
|
150
243
|
});
|
|
151
244
|
};
|
|
152
245
|
var anyInstalledCodex = () => true;
|
|
@@ -159,20 +252,15 @@ var inspectProviderBinaries = (candidates) => {
|
|
|
159
252
|
const binaries = {};
|
|
160
253
|
for (const provider of MANAGED_PROVIDERS) {
|
|
161
254
|
const binary = candidates[provider];
|
|
162
|
-
if (
|
|
163
|
-
try {
|
|
164
|
-
accessSync(binary, constants.X_OK);
|
|
165
|
-
if (statSync2(binary).isFile()) binaries[provider] = binary;
|
|
166
|
-
} catch {
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
255
|
+
if (binary && isExecutableFile(binary)) binaries[provider] = binary;
|
|
169
256
|
}
|
|
170
257
|
return {
|
|
171
258
|
binaries,
|
|
172
259
|
capabilities: providerLiveCapabilities({
|
|
173
260
|
claude: binaries.claude !== void 0,
|
|
174
261
|
codex: binaries.codex !== void 0 && !codexBinaryIsBroken(binaries.codex),
|
|
175
|
-
geminiVersion: binaries.gemini ? resolvePackageVersionFromBinary(binaries.gemini, "@google/gemini-cli") : void 0
|
|
262
|
+
geminiVersion: binaries.gemini ? resolvePackageVersionFromBinary(binaries.gemini, "@google/gemini-cli") : void 0,
|
|
263
|
+
openCodeVersion: binaries.opencode ? readOpenCodeVersion(binaries.opencode) : void 0
|
|
176
264
|
})
|
|
177
265
|
};
|
|
178
266
|
};
|
|
@@ -217,7 +305,10 @@ var trackProviderInventory = async (providers, onChange, home = homedir()) => {
|
|
|
217
305
|
export {
|
|
218
306
|
checkCodexInstall,
|
|
219
307
|
nodeCodexInstallProbe,
|
|
308
|
+
OPENCODE_DESKTOP_CLI,
|
|
220
309
|
geminiLiveCapabilities,
|
|
310
|
+
openCodeLiveCapabilities,
|
|
311
|
+
openCodeVersionFromOutput,
|
|
221
312
|
providerLiveCapabilities,
|
|
222
313
|
launchableProviders,
|
|
223
314
|
hasSpawnProvider,
|
|
@@ -225,6 +316,14 @@ export {
|
|
|
225
316
|
missingControlPrerequisite,
|
|
226
317
|
describeMissingControlPrerequisite,
|
|
227
318
|
phoneStartIsRequired,
|
|
319
|
+
isManagedProvider,
|
|
320
|
+
isManagedProviderAgent,
|
|
321
|
+
managedProvidersOfAgents,
|
|
322
|
+
openCodeLaunchReadiness,
|
|
323
|
+
describeOpenCodeLaunchReadiness,
|
|
324
|
+
isExecutableFile,
|
|
325
|
+
openCodeInstallCandidates,
|
|
326
|
+
readOpenCodeVersion,
|
|
228
327
|
resolveProviderBinary,
|
|
229
328
|
codexBinaryIsBroken,
|
|
230
329
|
detectProviderLiveCapabilities,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addGeminiMcpServer,
|
|
3
3
|
removeGeminiMcpServer
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YRGDHBS5.js";
|
|
5
5
|
import {
|
|
6
6
|
CLAUDE_CODE_AGENT
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7VNTZY7V.js";
|
|
8
8
|
import {
|
|
9
9
|
compatibleToolLookup
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Z2DAWG5U.js";
|
|
11
11
|
import {
|
|
12
12
|
CLAUDE_HOOK_EVENTS,
|
|
13
13
|
PUSHARY_MCP_URL,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
isPusharyHook,
|
|
20
20
|
registerHookEntry,
|
|
21
21
|
removeClaudeMcpServers
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3NTAU6DN.js";
|
|
23
23
|
import {
|
|
24
24
|
HOOK_COMPATIBLE_PROFILES,
|
|
25
25
|
PHONE_ANSWERED_TOOLS,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
pusharyMissingReason,
|
|
31
31
|
refusalOutput,
|
|
32
32
|
withHookHoldBudget
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-AYP4GE3X.js";
|
|
34
34
|
|
|
35
35
|
// src/config-document.ts
|
|
36
36
|
import { parse, stringify } from "smol-toml";
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
} from "./chunk-OYIN77HO.js";
|
|
6
6
|
import {
|
|
7
7
|
readMacAppAgentKey
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-E25IZ5S3.js";
|
|
9
9
|
import {
|
|
10
10
|
API_KEYS_PATH
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RVIYAQC7.js";
|
|
12
12
|
import {
|
|
13
13
|
absoluteUrl
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WDPIZXCZ.js";
|
|
15
15
|
import {
|
|
16
16
|
findExportedKeyLines,
|
|
17
17
|
isAdoptedMacAppKey,
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
readConfigFileKey,
|
|
22
22
|
readKeySource,
|
|
23
23
|
readMacAppKeyPrefix
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-ZTNGM6NU.js";
|
|
25
25
|
import {
|
|
26
26
|
isValidApiKey
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-AYP4GE3X.js";
|
|
28
28
|
|
|
29
29
|
// src/cli/held-key-revocation.ts
|
|
30
30
|
var readCliHeldKeys = (profiles) => {
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
keyPrefix,
|
|
5
5
|
readConfigFileKey,
|
|
6
6
|
readMacAppKeyPrefix
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZTNGM6NU.js";
|
|
8
8
|
import {
|
|
9
9
|
NPX_LATEST_COMMAND
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MWKKUBHQ.js";
|
|
11
11
|
|
|
12
12
|
// src/key-signed-out.ts
|
|
13
13
|
var VERDICT_BY_CHECK = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureCodexTrustsPusharyHooks
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QMV7WS7D.js";
|
|
4
4
|
import {
|
|
5
5
|
hermesReceiptPaths,
|
|
6
6
|
hermesSetupPredatesThePluginFolder,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
refreshHermesPluginFiles,
|
|
10
10
|
refreshOpenClawPlugin,
|
|
11
11
|
shippedHermesPlugin
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-D7GUUTOT.js";
|
|
13
13
|
import {
|
|
14
14
|
fxIgnoresInstructionsFile,
|
|
15
15
|
fxInstructionsBody,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
macAppFxBridge,
|
|
19
19
|
refreshClineKey,
|
|
20
20
|
switchFxHttpEntryToBridge
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-P3MYHWF5.js";
|
|
22
22
|
import {
|
|
23
23
|
OPENCODE_HOOK_BINARY,
|
|
24
24
|
agentHookOwner,
|
|
@@ -31,16 +31,16 @@ import {
|
|
|
31
31
|
openCodePluginDir,
|
|
32
32
|
openCodeWired,
|
|
33
33
|
withOpenCodeAskRules
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-SYIAWMBA.js";
|
|
35
35
|
import {
|
|
36
36
|
detectClaudeVersion
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-2JSTCD7L.js";
|
|
38
38
|
import {
|
|
39
39
|
addCompatibleHooks,
|
|
40
40
|
compatibleConfigFile,
|
|
41
41
|
compatibleInstructionsFile,
|
|
42
42
|
hasCompatibleHooks
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-N2L7E5NE.js";
|
|
44
44
|
import {
|
|
45
45
|
GEMINI_HOOK_BINARY,
|
|
46
46
|
addGeminiHooks,
|
|
@@ -52,10 +52,10 @@ import {
|
|
|
52
52
|
geminiWired,
|
|
53
53
|
hasGeminiHooks,
|
|
54
54
|
planHooks
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-YRGDHBS5.js";
|
|
56
56
|
import {
|
|
57
57
|
KEY_FILE_MODE
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-ZTNGM6NU.js";
|
|
59
59
|
import {
|
|
60
60
|
CLAUDE_CODE_PUSHARY_PERMISSION_RULES,
|
|
61
61
|
CLAUDE_HOOK_BINARY,
|
|
@@ -102,13 +102,13 @@ import {
|
|
|
102
102
|
renderAgentInstructions,
|
|
103
103
|
supportedClaudeEvents,
|
|
104
104
|
vscodePluginMcp
|
|
105
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-3NTAU6DN.js";
|
|
106
106
|
import {
|
|
107
107
|
formatVersion,
|
|
108
108
|
hookCommandsUseBareNames,
|
|
109
109
|
resolveGlobalBinDir,
|
|
110
110
|
resolveGlobalBinary
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-BKZZSXEQ.js";
|
|
112
112
|
import {
|
|
113
113
|
readJsonSafe,
|
|
114
114
|
writeFileAtomic,
|
|
@@ -118,7 +118,7 @@ import {
|
|
|
118
118
|
HOOK_COMPATIBLE_PROFILES,
|
|
119
119
|
isCompatibleAgentType,
|
|
120
120
|
isRecord
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-AYP4GE3X.js";
|
|
122
122
|
|
|
123
123
|
// src/reapply.ts
|
|
124
124
|
import { dirname, join } from "path";
|
|
@@ -276,6 +276,9 @@ var inspectConfiguredManagedProviders = (paths = {}) => {
|
|
|
276
276
|
if (geminiWired({ settings: gemini })) {
|
|
277
277
|
providers.push("gemini");
|
|
278
278
|
}
|
|
279
|
+
if (openCodeWired(paths.openCodePluginDir ?? openCodePluginDir())) {
|
|
280
|
+
providers.push("opencode");
|
|
281
|
+
}
|
|
279
282
|
return providers;
|
|
280
283
|
};
|
|
281
284
|
var codexNativeOwnershipFor = (hooksConfig, requested, macAppAvailable) => hooksConfig === null && macAppAvailable ? "preserve" : requested;
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
configFailureKind,
|
|
5
5
|
retryAgentCommand,
|
|
6
6
|
writeSetupConfigFile
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CTJRWP6Y.js";
|
|
8
8
|
import {
|
|
9
9
|
MCP_BRIDGE_BINARY
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RM3YENVK.js";
|
|
11
11
|
import {
|
|
12
12
|
KEY_FILE_MODE
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZTNGM6NU.js";
|
|
14
14
|
import {
|
|
15
15
|
CLINE_SERVER_NAME_TAKEN,
|
|
16
16
|
CLINE_SETTINGS_REFUSALS,
|
|
@@ -32,10 +32,10 @@ import {
|
|
|
32
32
|
withClinePusharyServer,
|
|
33
33
|
withRefreshedClineKey,
|
|
34
34
|
withoutClinePusharyServer
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-3NTAU6DN.js";
|
|
36
36
|
import {
|
|
37
37
|
resolveGlobalBinary
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-BKZZSXEQ.js";
|
|
39
39
|
import {
|
|
40
40
|
readJsonSafe,
|
|
41
41
|
writeFileAtomic,
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
codexHome,
|
|
8
8
|
codexHooksJsonIn,
|
|
9
9
|
isPusharyCodexCommand
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3NTAU6DN.js";
|
|
11
11
|
import {
|
|
12
12
|
resolvePathBinary
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BKZZSXEQ.js";
|
|
14
14
|
import {
|
|
15
15
|
getPackageVersion
|
|
16
16
|
} from "./chunk-UQTQ6HPO.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
autoUpdateLock
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3NTAU6DN.js";
|
|
4
4
|
import {
|
|
5
5
|
installPackageGlobally,
|
|
6
6
|
npmErrorMessage,
|
|
7
7
|
throwIfNpmRefusesInstall
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BKZZSXEQ.js";
|
|
9
9
|
import {
|
|
10
10
|
writeJsonAtomic
|
|
11
11
|
} from "./chunk-PM2NRK6Y.js";
|
|
@@ -8,31 +8,36 @@ import {
|
|
|
8
8
|
SubscriptionRequiredError,
|
|
9
9
|
callMcpTool,
|
|
10
10
|
isRetryable
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-32YARQJC.js";
|
|
12
12
|
import {
|
|
13
13
|
fetchAsCredential
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PJHYFHP4.js";
|
|
15
15
|
import {
|
|
16
16
|
installNetworkDefaults,
|
|
17
17
|
isNetworkFailure
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-XJG7YRF7.js";
|
|
19
19
|
import {
|
|
20
20
|
clientReportClaims
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3NTAU6DN.js";
|
|
22
22
|
import {
|
|
23
23
|
getApiKey,
|
|
24
24
|
getBaseUrl
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ZPHPNTGW.js";
|
|
26
26
|
import {
|
|
27
27
|
ASK_AGENT_NAME_MAX,
|
|
28
28
|
CLIENT_REPORT_PATH,
|
|
29
29
|
DECISION_LINE_MAX,
|
|
30
30
|
GATE_PERMISSION_MODE_MAX_LENGTH,
|
|
31
31
|
TOOL_FAILURE_CODES,
|
|
32
|
+
WAIT_END_CLOSED,
|
|
33
|
+
WAIT_END_OPEN,
|
|
34
|
+
WAIT_END_PATH,
|
|
32
35
|
degradedLine,
|
|
33
36
|
isDecisionStoppedReply,
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
isRecord,
|
|
38
|
+
truncateLine,
|
|
39
|
+
waitEndAnswered
|
|
40
|
+
} from "./chunk-AYP4GE3X.js";
|
|
36
41
|
|
|
37
42
|
// src/api.ts
|
|
38
43
|
import { randomUUID } from "crypto";
|
|
@@ -319,7 +324,44 @@ var sleepUnlessAborted = (ms, signal) => new Promise((resolve) => {
|
|
|
319
324
|
signal?.addEventListener("abort", wake, { once: true });
|
|
320
325
|
});
|
|
321
326
|
var boundedBy = (timeoutMs, signal) => signal ? AbortSignal.any([AbortSignal.timeout(timeoutMs), signal]) : AbortSignal.timeout(timeoutMs);
|
|
322
|
-
var
|
|
327
|
+
var WITHDRAW_AT_THE_DEADLINE = { kind: "withdraw" };
|
|
328
|
+
var LEFT_OPEN = { answered: false, status: "left_open" };
|
|
329
|
+
var isLeftOpen = (answer) => answer.status === LEFT_OPEN.status;
|
|
330
|
+
var WAIT_END_TIMEOUT_MS = 2e3;
|
|
331
|
+
var isAnswerValue = (value) => typeof value === "string" && value.length > 0;
|
|
332
|
+
var isAbsentOrNote = (note) => note === void 0 || typeof note === "string";
|
|
333
|
+
var answeredWaitEndOf = (body) => isAnswerValue(body.value) && isAbsentOrNote(body.note) ? waitEndAnswered(body.value, body.note ?? null) : WAIT_END_CLOSED;
|
|
334
|
+
var readWaitEndReply = (body) => {
|
|
335
|
+
if (!isRecord(body)) return WAIT_END_CLOSED;
|
|
336
|
+
switch (body.kind) {
|
|
337
|
+
case "answered":
|
|
338
|
+
return answeredWaitEndOf(body);
|
|
339
|
+
case "open":
|
|
340
|
+
return WAIT_END_OPEN;
|
|
341
|
+
default:
|
|
342
|
+
return WAIT_END_CLOSED;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
var endWait = async (apiKey, request, signal) => {
|
|
346
|
+
try {
|
|
347
|
+
return readWaitEndReply(await postAgentRequest(apiKey, WAIT_END_PATH, request, WAIT_END_TIMEOUT_MS, signal));
|
|
348
|
+
} catch (error) {
|
|
349
|
+
if (!signal?.aborted) void reportClientError({ kind: clientErrorKindOf(error), code: "wait_end_failed" });
|
|
350
|
+
return WAIT_END_CLOSED;
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
var answerOfAnEndedWait = (reply) => reply.note === void 0 ? { answered: true, value: reply.value } : { answered: true, value: reply.value, note: reply.note };
|
|
354
|
+
var settleAnEndedWait = (reply, withdraw, signal) => {
|
|
355
|
+
if (reply.kind === "answered") return Promise.resolve(answerOfAnEndedWait(reply));
|
|
356
|
+
if (signal?.aborted) return Promise.resolve(ABANDONED_WAIT);
|
|
357
|
+
return reply.kind === "open" ? Promise.resolve(LEFT_OPEN) : withdraw();
|
|
358
|
+
};
|
|
359
|
+
var settleAtTheDeadline = async (apiKey, correlationId, atDeadline, withdraw, signal) => {
|
|
360
|
+
if (atDeadline.kind === "withdraw") return withdraw();
|
|
361
|
+
const reply = await endWait(apiKey, { correlationId, toolUseId: atDeadline.toolUseId, machineId: atDeadline.machineId }, signal);
|
|
362
|
+
return settleAnEndedWait(reply, withdraw, signal);
|
|
363
|
+
};
|
|
364
|
+
var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3, signal, atDeadline = WITHDRAW_AT_THE_DEADLINE) => {
|
|
323
365
|
let failures = 0;
|
|
324
366
|
let waitedThroughAnOutage = false;
|
|
325
367
|
while (Date.now() < deadlineMs) {
|
|
@@ -346,28 +388,30 @@ var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3
|
|
|
346
388
|
await sleepUnlessAborted(Math.min(pollInterval, Math.max(0, deadlineMs - Date.now())), signal);
|
|
347
389
|
}
|
|
348
390
|
if (signal?.aborted) return ABANDONED_WAIT;
|
|
349
|
-
|
|
391
|
+
const withdraw = () => waitedThroughAnOutage ? withdrawAfterAFailedPoll(apiKey, correlationId) : withdrawQuestion(apiKey, correlationId);
|
|
392
|
+
return settleAtTheDeadline(apiKey, correlationId, atDeadline, withdraw, signal);
|
|
350
393
|
};
|
|
351
394
|
var CANCEL_QUESTION_TIMEOUT_MS = 4e3;
|
|
352
395
|
var cancelQuestion = async (apiKey, correlationId, signal, baseUrl) => {
|
|
353
396
|
return callMcpTool(apiKey, "cancel_question", { correlationId }, { signal, timeoutMs: CANCEL_QUESTION_TIMEOUT_MS, maxRetries: 1, baseUrl });
|
|
354
397
|
};
|
|
398
|
+
var WITHDRAW_READ_TIMEOUT_MS = 2e3;
|
|
355
399
|
var withdrawQuestion = async (apiKey, correlationId, transport = { cancelQuestion, waitForAnswer }) => {
|
|
356
400
|
try {
|
|
357
|
-
const cancelled = await transport.cancelQuestion(apiKey, correlationId, AbortSignal.timeout(
|
|
401
|
+
const cancelled = await transport.cancelQuestion(apiKey, correlationId, AbortSignal.timeout(CANCEL_QUESTION_TIMEOUT_MS));
|
|
358
402
|
if (!cancelled || isDecisionStopped(cancelled)) return STOPPED;
|
|
359
403
|
if (cancelled.cancelled === true) return { answered: false, status: "withdrawn" };
|
|
360
|
-
const late = await transport.waitForAnswer(apiKey, correlationId, 1e3, AbortSignal.timeout(
|
|
404
|
+
const late = await transport.waitForAnswer(apiKey, correlationId, 1e3, AbortSignal.timeout(WITHDRAW_READ_TIMEOUT_MS));
|
|
361
405
|
if (late.answered || isDecisionStopped(late)) return late;
|
|
362
406
|
return late.status === "expired" ? { answered: false, status: "withdrawn" } : STOPPED;
|
|
363
407
|
} catch {
|
|
364
408
|
return STOPPED;
|
|
365
409
|
}
|
|
366
410
|
};
|
|
367
|
-
var waitForQuestion = async (apiKey, question, deadlineMs, pollInterval = 2e3, signal) => {
|
|
411
|
+
var waitForQuestion = async (apiKey, question, deadlineMs, pollInterval = 2e3, signal, atDeadline = WITHDRAW_AT_THE_DEADLINE) => {
|
|
368
412
|
if (isDecisionStopped(question) || question.answered) return { ...question, answered: !!question.answered };
|
|
369
413
|
if (question.status === "expired") return STOPPED;
|
|
370
|
-
return isAwayPaused(question) || isLocalQuestionHandoff(question) ? withdrawQuestion(apiKey, question.correlationId) : pollForAnswer(apiKey, question.correlationId, deadlineMs, pollInterval, signal);
|
|
414
|
+
return isAwayPaused(question) || isLocalQuestionHandoff(question) ? withdrawQuestion(apiKey, question.correlationId) : pollForAnswer(apiKey, question.correlationId, deadlineMs, pollInterval, signal, atDeadline);
|
|
371
415
|
};
|
|
372
416
|
var OPEN_QUESTION_CLOSED = { answered: false, status: "withdrawn" };
|
|
373
417
|
var OPEN_QUESTION_LATE_ANSWER_HOLD_MS = 1e3;
|
|
@@ -420,12 +464,12 @@ var sendNotification = async (apiKey, params, timeoutMs = 15e3, signal) => {
|
|
|
420
464
|
};
|
|
421
465
|
var GATE_PATH = "/api/agent/gate";
|
|
422
466
|
var BLOCKED_ACTION_CLAIM_PATH = "/api/agent/blocked-action/claim";
|
|
423
|
-
var postAgentRequest = async (apiKey, path, body, timeoutMs) => {
|
|
467
|
+
var postAgentRequest = async (apiKey, path, body, timeoutMs, signal) => {
|
|
424
468
|
const response = await fetchAsCredential(apiKey, `${getBaseUrl()}${path}`, {
|
|
425
469
|
method: "POST",
|
|
426
470
|
headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
|
|
427
471
|
body: JSON.stringify(body),
|
|
428
|
-
signal:
|
|
472
|
+
signal: boundedBy(timeoutMs, signal)
|
|
429
473
|
});
|
|
430
474
|
if (!response.ok) throw new Error(`${path} rejected (${response.status})`);
|
|
431
475
|
return response.json();
|
|
@@ -474,9 +518,14 @@ export {
|
|
|
474
518
|
isTransientWaitFailure,
|
|
475
519
|
waitRetryPauseMs,
|
|
476
520
|
sleepUnlessAborted,
|
|
521
|
+
WITHDRAW_AT_THE_DEADLINE,
|
|
522
|
+
LEFT_OPEN,
|
|
523
|
+
isLeftOpen,
|
|
524
|
+
WAIT_END_TIMEOUT_MS,
|
|
477
525
|
pollForAnswer,
|
|
478
526
|
CANCEL_QUESTION_TIMEOUT_MS,
|
|
479
527
|
cancelQuestion,
|
|
528
|
+
WITHDRAW_READ_TIMEOUT_MS,
|
|
480
529
|
withdrawQuestion,
|
|
481
530
|
waitForQuestion,
|
|
482
531
|
reportFailedQuestionWithdrawal,
|