agentapprove 0.2.1 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +92 -201
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2144,122 +2144,6 @@ async function refreshHooksAfterPairing(hooksDir, token, apiUrl, deps) {
|
|
|
2144
2144
|
return { filtersRefreshed: !(filters.failed.length || filters.terminalFailure) };
|
|
2145
2145
|
}
|
|
2146
2146
|
|
|
2147
|
-
// src/pairing-effective-config.ts
|
|
2148
|
-
var PRIVACY_RANK = { minimal: 0, summary: 1, full: 2 };
|
|
2149
|
-
var FAIL_RANK = { allow: 0, ask: 1, deny: 2 };
|
|
2150
|
-
var SETTING_LABEL = {
|
|
2151
|
-
privacyTier: "Privacy level",
|
|
2152
|
-
retentionDays: "Data retention",
|
|
2153
|
-
failBehavior: "If Agent Approve cannot be reached",
|
|
2154
|
-
e2eEnabled: "End-to-end encryption"
|
|
2155
|
-
};
|
|
2156
|
-
function isPrivacyTier(value) {
|
|
2157
|
-
return value === "minimal" || value === "summary" || value === "full";
|
|
2158
|
-
}
|
|
2159
|
-
function isFailBehavior(value) {
|
|
2160
|
-
return value === "allow" || value === "ask" || value === "deny";
|
|
2161
|
-
}
|
|
2162
|
-
function describeRetention(days) {
|
|
2163
|
-
if (days === null)
|
|
2164
|
-
return "keep forever";
|
|
2165
|
-
return days === 1 ? "1 day" : `${days} days`;
|
|
2166
|
-
}
|
|
2167
|
-
var DEFAULT_FAIL_BEHAVIOR = "ask";
|
|
2168
|
-
var DEFAULT_PRIVACY_TIER = "full";
|
|
2169
|
-
function parseEffectivePairingConfig(value) {
|
|
2170
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
2171
|
-
return null;
|
|
2172
|
-
const candidate = value;
|
|
2173
|
-
const parsed = {};
|
|
2174
|
-
if (isPrivacyTier(candidate.privacyTier))
|
|
2175
|
-
parsed.privacyTier = candidate.privacyTier;
|
|
2176
|
-
const retention = candidate.retentionDays;
|
|
2177
|
-
if (retention === null || typeof retention === "number" && Number.isFinite(retention) && retention >= 0) {
|
|
2178
|
-
parsed.retentionDays = retention;
|
|
2179
|
-
}
|
|
2180
|
-
if (isFailBehavior(candidate.failBehavior))
|
|
2181
|
-
parsed.failBehavior = candidate.failBehavior;
|
|
2182
|
-
if (typeof candidate.e2eEnabled === "boolean")
|
|
2183
|
-
parsed.e2eEnabled = candidate.e2eEnabled;
|
|
2184
|
-
return parsed;
|
|
2185
|
-
}
|
|
2186
|
-
function reconcilePairingConfig(picks, effective, options = {}) {
|
|
2187
|
-
const local = {
|
|
2188
|
-
privacyTier: picks.privacyTier,
|
|
2189
|
-
retentionDays: picks.retentionDays,
|
|
2190
|
-
failBehavior: picks.failBehavior,
|
|
2191
|
-
e2eEnabled: picks.e2eEnabled
|
|
2192
|
-
};
|
|
2193
|
-
const accountKept = [];
|
|
2194
|
-
const unknown = [];
|
|
2195
|
-
const account = effective ?? {};
|
|
2196
|
-
const accountPrivacy = account.privacyTier ?? (isPrivacyTier(options.reportedPrivacy) ? options.reportedPrivacy : undefined);
|
|
2197
|
-
if (accountPrivacy === undefined) {
|
|
2198
|
-
unknown.push("privacyTier");
|
|
2199
|
-
if (PRIVACY_RANK[DEFAULT_PRIVACY_TIER] < PRIVACY_RANK[local.privacyTier])
|
|
2200
|
-
local.privacyTier = DEFAULT_PRIVACY_TIER;
|
|
2201
|
-
} else if (PRIVACY_RANK[accountPrivacy] < PRIVACY_RANK[picks.privacyTier]) {
|
|
2202
|
-
local.privacyTier = accountPrivacy;
|
|
2203
|
-
accountKept.push({ setting: "privacyTier", picked: picks.privacyTier, kept: accountPrivacy });
|
|
2204
|
-
}
|
|
2205
|
-
if (account.retentionDays === undefined) {
|
|
2206
|
-
unknown.push("retentionDays");
|
|
2207
|
-
} else if (account.retentionDays !== null && account.retentionDays < picks.retentionDays) {
|
|
2208
|
-
local.retentionDays = account.retentionDays;
|
|
2209
|
-
accountKept.push({
|
|
2210
|
-
setting: "retentionDays",
|
|
2211
|
-
picked: describeRetention(picks.retentionDays),
|
|
2212
|
-
kept: describeRetention(account.retentionDays)
|
|
2213
|
-
});
|
|
2214
|
-
}
|
|
2215
|
-
if (account.failBehavior === undefined) {
|
|
2216
|
-
unknown.push("failBehavior");
|
|
2217
|
-
if (FAIL_RANK[DEFAULT_FAIL_BEHAVIOR] > FAIL_RANK[local.failBehavior])
|
|
2218
|
-
local.failBehavior = DEFAULT_FAIL_BEHAVIOR;
|
|
2219
|
-
} else if (FAIL_RANK[account.failBehavior] > FAIL_RANK[picks.failBehavior]) {
|
|
2220
|
-
local.failBehavior = account.failBehavior;
|
|
2221
|
-
accountKept.push({ setting: "failBehavior", picked: picks.failBehavior, kept: account.failBehavior });
|
|
2222
|
-
}
|
|
2223
|
-
let encryptionRequired = false;
|
|
2224
|
-
if (account.e2eEnabled === undefined) {
|
|
2225
|
-
unknown.push("e2eEnabled");
|
|
2226
|
-
if (!picks.e2eEnabled && options.localE2eOn === true)
|
|
2227
|
-
local.e2eEnabled = true;
|
|
2228
|
-
} else if (account.e2eEnabled && !picks.e2eEnabled) {
|
|
2229
|
-
encryptionRequired = true;
|
|
2230
|
-
accountKept.push({ setting: "e2eEnabled", picked: "off", kept: "on" });
|
|
2231
|
-
}
|
|
2232
|
-
return { local, accountKept, unknown, encryptionRequired, letAccountWin: unknown.length > 0 };
|
|
2233
|
-
}
|
|
2234
|
-
function formatAccountKeptWarning(reconciliation) {
|
|
2235
|
-
const kept = reconciliation.accountKept.filter((entry) => entry.setting !== "e2eEnabled");
|
|
2236
|
-
if (kept.length === 0)
|
|
2237
|
-
return null;
|
|
2238
|
-
return [
|
|
2239
|
-
"Your Agent Approve account kept its stricter settings. This computer now uses them:",
|
|
2240
|
-
...kept.map((entry) => ` ${SETTING_LABEL[entry.setting]}: ${entry.kept} (you chose ${entry.picked})`),
|
|
2241
|
-
"You can change account settings in the Agent Approve app."
|
|
2242
|
-
].join(`
|
|
2243
|
-
`);
|
|
2244
|
-
}
|
|
2245
|
-
function formatAccountUnknownNote(reconciliation) {
|
|
2246
|
-
if (reconciliation.unknown.length === 0)
|
|
2247
|
-
return null;
|
|
2248
|
-
const names = reconciliation.unknown.map((setting) => SETTING_LABEL[setting]).join(", ");
|
|
2249
|
-
return `This pairing could not confirm your account's value for: ${names}. ` + "This computer uses the safer value for now and picks up your account settings on the next agent event.";
|
|
2250
|
-
}
|
|
2251
|
-
function formatEncryptionRequiredMessage(rerun) {
|
|
2252
|
-
const again = rerun === "pair" ? 'Run "npx agentapprove pair" again and choose an encryption key instead of disabling encryption.' : 'Run "npx agentapprove" again and keep end-to-end encryption on (choose Customize if you are not asked, and do not pass --no-e2e).';
|
|
2253
|
-
return [
|
|
2254
|
-
"This computer is not set up yet.",
|
|
2255
|
-
"Your Agent Approve account has end-to-end encryption turned on, and this setup chose to leave it off.",
|
|
2256
|
-
"Pairing a computer cannot turn encryption off for the account, and the encryption key can only be created during setup, so this computer has no key to use.",
|
|
2257
|
-
"Nothing from this pairing was saved on this computer. If it was set up before, its earlier pairing has been replaced and will not work until you set it up again.",
|
|
2258
|
-
again
|
|
2259
|
-
].join(`
|
|
2260
|
-
`);
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
2147
|
// src/pair-key-plan.ts
|
|
2264
2148
|
import { createHash } from "crypto";
|
|
2265
2149
|
import { existsSync as existsSync3, readFileSync as readFileSync2, renameSync as renameSync2 } from "fs";
|
|
@@ -2328,6 +2212,28 @@ function runOpenClaw(args) {
|
|
|
2328
2212
|
const result = spawnSync("openclaw", args, { stdio: "inherit", shell: process.platform === "win32" });
|
|
2329
2213
|
return !result.error && result.status === 0;
|
|
2330
2214
|
}
|
|
2215
|
+
function isExpectedOpenClawActive(report, version) {
|
|
2216
|
+
if (!report || typeof report !== "object")
|
|
2217
|
+
return false;
|
|
2218
|
+
const plugins = report.plugins;
|
|
2219
|
+
if (!Array.isArray(plugins))
|
|
2220
|
+
return false;
|
|
2221
|
+
const matches = plugins.filter((plugin) => plugin?.id === "openclaw");
|
|
2222
|
+
return matches.length === 1 && matches[0].packageName === "@agentapprove/openclaw" && matches[0].version === version && matches[0].installed === true && matches[0].enabled === true && matches[0].runtime?.state === "active";
|
|
2223
|
+
}
|
|
2224
|
+
function readOpenClawActive(version) {
|
|
2225
|
+
try {
|
|
2226
|
+
const result = spawnSync("openclaw", ["gateway", "call", "plugins.list", "--json"], {
|
|
2227
|
+
encoding: "utf8",
|
|
2228
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
2229
|
+
timeout: 15000,
|
|
2230
|
+
shell: process.platform === "win32"
|
|
2231
|
+
});
|
|
2232
|
+
return !result.error && result.status === 0 && isExpectedOpenClawActive(JSON.parse(result.stdout), version);
|
|
2233
|
+
} catch {
|
|
2234
|
+
return false;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2331
2237
|
function mergeOpenClawConfig(config, conversationAccess) {
|
|
2332
2238
|
const plugins = config.plugins ?? {};
|
|
2333
2239
|
const entries = plugins.entries ?? {};
|
|
@@ -2357,6 +2263,7 @@ async function installOpenClaw(options) {
|
|
|
2357
2263
|
return fail("Could not read OpenClaw configuration as JSON. No plugin installation or permission changes were made. Check the config before retrying.");
|
|
2358
2264
|
}
|
|
2359
2265
|
const installed = options.readVersion();
|
|
2266
|
+
let installedThisRun = false;
|
|
2360
2267
|
if (installed !== options.version) {
|
|
2361
2268
|
const args = ["plugins", "install", options.spec];
|
|
2362
2269
|
if (installed !== null) {
|
|
@@ -2370,17 +2277,21 @@ async function installOpenClaw(options) {
|
|
|
2370
2277
|
const actual = options.readVersion();
|
|
2371
2278
|
if (actual !== options.version)
|
|
2372
2279
|
return fail(`OpenClaw installed ${actual ?? "an unverified version"}, expected ${options.version}.`);
|
|
2280
|
+
installedThisRun = true;
|
|
2373
2281
|
}
|
|
2282
|
+
let configChanged = false;
|
|
2374
2283
|
try {
|
|
2375
2284
|
const current = options.readConfig();
|
|
2376
2285
|
const updated = mergeOpenClawConfig(current, true);
|
|
2377
|
-
|
|
2286
|
+
configChanged = !isDeepStrictEqual(current, updated);
|
|
2287
|
+
if (configChanged)
|
|
2378
2288
|
options.writeConfig(updated);
|
|
2379
2289
|
} catch {
|
|
2380
2290
|
return fail("Could not read or save OpenClaw configuration. The plugin package is present; check the config and retry setup before using it.");
|
|
2381
2291
|
}
|
|
2382
2292
|
const action = options.mode === "approval" ? "enable" : "disable";
|
|
2383
|
-
|
|
2293
|
+
const alreadyApplied = action === "enable" && installedThisRun && !configChanged && (options.readActive ?? readOpenClawActive)(options.version);
|
|
2294
|
+
if (!alreadyApplied && !run(["plugins", action, "openclaw"]))
|
|
2384
2295
|
return fail(`Agent Approve v${options.version} is installed, but OpenClaw ${action} did not complete. Review the host output above. If the Gateway is still reloading, wait for it to finish, then run: openclaw plugins ${action} openclaw. Activation remains controlled by OpenClaw.`);
|
|
2385
2296
|
return {
|
|
2386
2297
|
success: true,
|
|
@@ -3807,8 +3718,7 @@ async function copyHookScripts(hooksDir, token, files, options) {
|
|
|
3807
3718
|
// src/hook-manifest.generated.ts
|
|
3808
3719
|
var HOOK_SCRIPT_SHA256 = {
|
|
3809
3720
|
"antigravity-hook.sh": [
|
|
3810
|
-
"
|
|
3811
|
-
"0cfac7fdab920af8b243dc8f0cffcc5355d06cec13a71060f1e77a22487379cf"
|
|
3721
|
+
"1f096235ba308087ad578aabdf2217f3e4f8ba336626ef2b70188f8dd2f24ac9"
|
|
3812
3722
|
],
|
|
3813
3723
|
"background-filter.js": [
|
|
3814
3724
|
"5850ec58a56474891627e54b4e34255a878b7d21037382296c5512ee6d250d54"
|
|
@@ -3823,7 +3733,6 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3823
3733
|
"8a61253504c99ecdf101b4fa8681a09489f128ef4ba6dcfb47450c881011654e"
|
|
3824
3734
|
],
|
|
3825
3735
|
"claude-pre-tool.sh": [
|
|
3826
|
-
"a4bae2a689b075762a11df659b10ca783c1c780af93277efe37a398243fbc8ed",
|
|
3827
3736
|
"5a317ed1eb620bf5751fbe50ac266295f9a9436a5b5368ff4d5f3ae1e0202f33"
|
|
3828
3737
|
],
|
|
3829
3738
|
"claude-prompt.sh": [
|
|
@@ -3836,8 +3745,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3836
3745
|
"dc2d906e448d277be0f9b5e1cd1b0bddadd9d5d86f6a0012ffa6e63cb38fb906"
|
|
3837
3746
|
],
|
|
3838
3747
|
"claude-stop.sh": [
|
|
3839
|
-
"158629503c11d44d3864c6a4ea5448e5743b4cacc11f0246ef604ce5a4c27830"
|
|
3840
|
-
"5dd2f71fb534dda5599af3bdaf44092134460ab46195254a830715d3cdf0936a"
|
|
3748
|
+
"158629503c11d44d3864c6a4ea5448e5743b4cacc11f0246ef604ce5a4c27830"
|
|
3841
3749
|
],
|
|
3842
3750
|
"claude-subagent-start.sh": [
|
|
3843
3751
|
"93738cd3c3667feae235fd08a44be6381f7e7d6291c102257ae1913917a58d17"
|
|
@@ -3852,15 +3760,13 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3852
3760
|
"b2d6a3352198a79780ace8303b476b37250d020d066d3be0b32719be34cb1198"
|
|
3853
3761
|
],
|
|
3854
3762
|
"codex-pre-tool.sh": [
|
|
3855
|
-
"3d1c6b7f8717f7b043d54f79af6225bebffb2baa4f0badde759182c415bcc343",
|
|
3856
3763
|
"6c44eb3f3774024d26a2d9162b9a91f1ac8c15559a164823f122aa0f423b454f"
|
|
3857
3764
|
],
|
|
3858
3765
|
"codex-session-start.sh": [
|
|
3859
3766
|
"b14351394abeab95d047d6843e34d52e33758eef1f4f129a31efe6334858db53"
|
|
3860
3767
|
],
|
|
3861
3768
|
"codex-stop.sh": [
|
|
3862
|
-
"6c46b605b482a474205d850cec28f35ced74796beedf1f2647a1268fcfa7d45e"
|
|
3863
|
-
"e0c3c95605c6f04004c4cb350ee7d997f471a7d07546e2e0b0fec9b9de845cd5"
|
|
3769
|
+
"6c46b605b482a474205d850cec28f35ced74796beedf1f2647a1268fcfa7d45e"
|
|
3864
3770
|
],
|
|
3865
3771
|
"codex-subagent-start.sh": [
|
|
3866
3772
|
"053caf81244b7510057c307d7dbc35f2190b0c5665dfdae252ae29e98744de4e"
|
|
@@ -3872,19 +3778,17 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3872
3778
|
"0e8886fa08e6c5529721f6e94907c9bad6c32e97c1f4827e2ef5270f349cce4f"
|
|
3873
3779
|
],
|
|
3874
3780
|
"common.sh": [
|
|
3875
|
-
"
|
|
3876
|
-
"
|
|
3781
|
+
"2c0407f51dfe95cf1bcc6c705a268ea461ab044e2808539339ad222a2b5ade2b",
|
|
3782
|
+
"e9878d93113337bd49ccfbc34f57aed38f0f93dad77eebe5b981adfe10ef82f2"
|
|
3877
3783
|
],
|
|
3878
3784
|
"completion-hook.sh": [
|
|
3879
3785
|
"ec94b799c35cd650b79d50f223bd57e817fed5d7e379aac5948e06f14ad7b31a"
|
|
3880
3786
|
],
|
|
3881
3787
|
"cursor-approval.sh": [
|
|
3882
|
-
"
|
|
3883
|
-
"cd831b97a0631202275d98925be1401b0b8915d4cf90783e158d05fea813cdfd"
|
|
3788
|
+
"66321a6409dbc77bbd9c83781b5112c4eb8e9139c62ce6e7952cb886d33ee996"
|
|
3884
3789
|
],
|
|
3885
3790
|
"cursor-mcp-approval.sh": [
|
|
3886
|
-
"
|
|
3887
|
-
"801cff771a4640a77d5c07e1d0c45038333650ceb3e169cf0b8c0d1eda22add9"
|
|
3791
|
+
"1d54625606519a8d1f763631aee8d2e9a92aede7b9619a9882174c0bc1059bb9"
|
|
3888
3792
|
],
|
|
3889
3793
|
"cursor-mcp-complete.sh": [
|
|
3890
3794
|
"0c7131db3e9007dc1e614cd5a132f08f4ee60030d48c0ee3fcb48074ae37c37b"
|
|
@@ -3893,8 +3797,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3893
3797
|
"44971e10d711667a659a493f062cadb4d44545c42aec0bbd24ad3821cfb27594"
|
|
3894
3798
|
],
|
|
3895
3799
|
"cursor-pre-tool.sh": [
|
|
3896
|
-
"
|
|
3897
|
-
"d5e397a1a33d300c61ef1afea4208927b3d1cfc292a67bd2b8084dbf718acc52"
|
|
3800
|
+
"41e804015779822adec39cf62efb0a71e055f83e56622612e6f39f0a80422906"
|
|
3898
3801
|
],
|
|
3899
3802
|
"cursor-precompact.sh": [
|
|
3900
3803
|
"33faedfd07999296911aa9080a2799938493114ad29878db025d6c42db418f83"
|
|
@@ -3915,8 +3818,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3915
3818
|
"23895ab6d2ecaa9fe278b3fb9d53b21418edd7cfac5116d53bd659d4ecbabae3"
|
|
3916
3819
|
],
|
|
3917
3820
|
"cursor-stop.sh": [
|
|
3918
|
-
"052c9de32572aeb8b5c9d27313cd20a27790a2250ce3c9aeb8e7356a755c5de3"
|
|
3919
|
-
"9fdb148a495a80173a5c8a627cd5f22e02d824ee5cc5e955e13bb5f0dce53d82"
|
|
3821
|
+
"052c9de32572aeb8b5c9d27313cd20a27790a2250ce3c9aeb8e7356a755c5de3"
|
|
3920
3822
|
],
|
|
3921
3823
|
"cursor-subagent-start.sh": [
|
|
3922
3824
|
"b614d1619331b2a900046efdf65eb5d759fb301d2aa7a115f0b107b1b41b3eb9"
|
|
@@ -3943,7 +3845,6 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3943
3845
|
"b074d767fe5e211a7f6434db1d2b02c6761df73b01f8defa703691cd1d986485"
|
|
3944
3846
|
],
|
|
3945
3847
|
"gemini-before-tool.sh": [
|
|
3946
|
-
"65c12342fd73cd200c6b6934b3742390e2f2d16524f9d643889c6b1107762ca9",
|
|
3947
3848
|
"222623ee4dd6ddd592d8aa0bcf3553d1acda3a2543cf6528bb3cabb50d2cb593"
|
|
3948
3849
|
],
|
|
3949
3850
|
"gemini-notification.sh": [
|
|
@@ -3956,8 +3857,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3956
3857
|
"5d1113f25accd644c82e21bbc7efc56739f549b6b8227bd8874afc6500112b46"
|
|
3957
3858
|
],
|
|
3958
3859
|
"gemini-stop.sh": [
|
|
3959
|
-
"da82707cd945b2307efa0a137e54f3dc9a630b2d02a5056d676ad49712f8534f"
|
|
3960
|
-
"dbf663489b778e8be2665f48ad601b99d43ae2462c43936276cb354505870ad8"
|
|
3860
|
+
"da82707cd945b2307efa0a137e54f3dc9a630b2d02a5056d676ad49712f8534f"
|
|
3961
3861
|
],
|
|
3962
3862
|
"github-error.sh": [
|
|
3963
3863
|
"e4dd8874cb837727c795a095ea5829eaa9d350ef65ab4c9fb802334558c44859"
|
|
@@ -3966,7 +3866,6 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3966
3866
|
"e057c5f624d7d4998ea59ef524b97b2364f860477a6aadd2512d562cdecfc6c2"
|
|
3967
3867
|
],
|
|
3968
3868
|
"github-pre-tool.sh": [
|
|
3969
|
-
"1066e08beb1ff864a8075cf9cd77ab1b64e5913f30675edd97cbb58e5fa05a7b",
|
|
3970
3869
|
"a331d5980824db7ca38a586f5f6398627b6653397eb4d5bcd19b18a293479c38"
|
|
3971
3870
|
],
|
|
3972
3871
|
"github-precompact.sh": [
|
|
@@ -3979,8 +3878,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3979
3878
|
"505f44ed4ca6345b8e9ff8a328198ed6141d4774a630821b984ab5cf4c3954ff"
|
|
3980
3879
|
],
|
|
3981
3880
|
"github-stop.sh": [
|
|
3982
|
-
"07f2d802700cf7ace009207aaa3f9c96e4e5943c022faa9601d9b85277e50fa4"
|
|
3983
|
-
"3f4d12832b22be48d708eb70f1bcb00d4c437a19c898e17a0989ab29d3efe4b4"
|
|
3881
|
+
"07f2d802700cf7ace009207aaa3f9c96e4e5943c022faa9601d9b85277e50fa4"
|
|
3984
3882
|
],
|
|
3985
3883
|
"github-subagent-start.sh": [
|
|
3986
3884
|
"506e39c02806ca20e8a3605a0de3eb089d9ef98d3556ceb675a70433ea313889"
|
|
@@ -3992,16 +3890,13 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3992
3890
|
"67ac8e7c33991402cc2dfcaf6b3380ba50b92cf224fcb447c2bb39cbd7c7a1a8"
|
|
3993
3891
|
],
|
|
3994
3892
|
"notify-hook.sh": [
|
|
3995
|
-
"
|
|
3996
|
-
"04013b4988d2d663279f6e75838244aad16247ccec7c37df1c4b5c4413505a05"
|
|
3893
|
+
"a222c9f656da5c9b0c6cb9998ddb6dd07608cabacef2931d542d68b04075632b"
|
|
3997
3894
|
],
|
|
3998
3895
|
"openhands-hook.sh": [
|
|
3999
|
-
"
|
|
4000
|
-
"f1c09c383891d2dd0048f74ab5c71a3d1a027d2a50a75ac1dc0cdee72c9772f2"
|
|
3896
|
+
"28cacd77360c53fdb7b095403dfc43c7b7cf83ff718ac85f7f1a9042652bd8c0"
|
|
4001
3897
|
],
|
|
4002
3898
|
"windsurf-hook.sh": [
|
|
4003
|
-
"
|
|
4004
|
-
"94753235d4de704a9a0399f734912000e23f9cd15ee1e494f584a0b49ebfda24"
|
|
3899
|
+
"b7e85df3b6188cd1dfd6b2eb904185e41b627e077a265eaa6bb88a804323b47d"
|
|
4005
3900
|
]
|
|
4006
3901
|
};
|
|
4007
3902
|
|
|
@@ -4042,6 +3937,32 @@ function enableHermesFollowUp(profile, run = (file, args) => runHostCommand(file
|
|
|
4042
3937
|
]);
|
|
4043
3938
|
}
|
|
4044
3939
|
|
|
3940
|
+
// src/hermes-hook-timeout.ts
|
|
3941
|
+
var HERMES_HOST_HOOK_TIMEOUT_SECONDS = 600;
|
|
3942
|
+
var TIMEOUT_KEY = "plugins.hook_callback_timeout";
|
|
3943
|
+
function ensureHermesHookTimeout(profile, run = runHostCommand) {
|
|
3944
|
+
if (!/^[a-z0-9][a-z0-9_-]{0,63}$/.test(profile)) {
|
|
3945
|
+
throw new Error("Invalid Hermes profile name");
|
|
3946
|
+
}
|
|
3947
|
+
const prefix = profile === "default" ? [] : ["-p", profile];
|
|
3948
|
+
let current;
|
|
3949
|
+
try {
|
|
3950
|
+
current = JSON.parse(run("hermes", [...prefix, "config", "get", TIMEOUT_KEY, "--json"]));
|
|
3951
|
+
} catch (error) {
|
|
3952
|
+
const failure = error;
|
|
3953
|
+
const stderr = typeof failure?.stderr === "string" ? failure.stderr : Buffer.isBuffer(failure?.stderr) ? failure.stderr.toString("utf8") : "";
|
|
3954
|
+
if (failure?.status === 1 && stderr.split(/\r?\n/).some((line) => line.trim() === `Config key not set: ${TIMEOUT_KEY}`))
|
|
3955
|
+
return;
|
|
3956
|
+
if (failure?.status === 2 && stderr.includes("argument config_command: invalid choice: 'get'"))
|
|
3957
|
+
return;
|
|
3958
|
+
throw new Error(`Could not read Hermes hook timeout for profile ${profile}. Check hermes ${profile === "default" ? "" : `-p ${profile} `}config get ${TIMEOUT_KEY} --json before retrying setup.`);
|
|
3959
|
+
}
|
|
3960
|
+
const value = typeof current === "number" ? current : typeof current === "string" && current.trim() !== "" ? Number(current) : NaN;
|
|
3961
|
+
if (Number.isFinite(value) && (value === 0 || value >= HERMES_HOST_HOOK_TIMEOUT_SECONDS))
|
|
3962
|
+
return;
|
|
3963
|
+
run("hermes", [...prefix, "config", "set", TIMEOUT_KEY, String(HERMES_HOST_HOOK_TIMEOUT_SECONDS)]);
|
|
3964
|
+
}
|
|
3965
|
+
|
|
4045
3966
|
// src/pairing-api-url.ts
|
|
4046
3967
|
function looksLikeHostedAgentApproveApi(baseUrl) {
|
|
4047
3968
|
try {
|
|
@@ -4123,7 +4044,7 @@ Configured on this computer: ${ready.join(", ")}. Nothing was changed.`);
|
|
|
4123
4044
|
}
|
|
4124
4045
|
|
|
4125
4046
|
// src/cli.ts
|
|
4126
|
-
var VERSION = "0.2.
|
|
4047
|
+
var VERSION = "0.2.4";
|
|
4127
4048
|
function getApiUrl() {
|
|
4128
4049
|
return process.env.AGENTAPPROVE_API || "https://api.agentapprove.com";
|
|
4129
4050
|
}
|
|
@@ -4162,14 +4083,14 @@ function getCommand() {
|
|
|
4162
4083
|
}
|
|
4163
4084
|
return filtered[0] || "install";
|
|
4164
4085
|
}
|
|
4165
|
-
var OPENCODE_PLUGIN_VERSION = "0.1.
|
|
4086
|
+
var OPENCODE_PLUGIN_VERSION = "0.1.28";
|
|
4166
4087
|
var OPENCODE_PLUGIN_SPEC = `@agentapprove/opencode@${OPENCODE_PLUGIN_VERSION}`;
|
|
4167
|
-
var OPENCLAW_PLUGIN_VERSION = "0.2.
|
|
4088
|
+
var OPENCLAW_PLUGIN_VERSION = "0.2.23";
|
|
4168
4089
|
var OPENCLAW_PLUGIN_SPEC = `@agentapprove/openclaw@${OPENCLAW_PLUGIN_VERSION}`;
|
|
4169
|
-
var PI_PLUGIN_VERSION = "0.1.
|
|
4090
|
+
var PI_PLUGIN_VERSION = "0.1.16";
|
|
4170
4091
|
var PI_PLUGIN_SPEC = `npm:@agentapprove/pi@${PI_PLUGIN_VERSION}`;
|
|
4171
4092
|
var PI_STATUS_TIMEOUT_MS = 5000;
|
|
4172
|
-
var HERMES_PLUGIN_VERSION = "0.1.
|
|
4093
|
+
var HERMES_PLUGIN_VERSION = "0.1.18";
|
|
4173
4094
|
var HERMES_PIP_DEPS = ["cryptography>=44.0,<46", "httpx>=0.27,<0.29"];
|
|
4174
4095
|
var AGENTS = {
|
|
4175
4096
|
"claude-code": {
|
|
@@ -5261,8 +5182,7 @@ async function waitForPairing(sessionCode, onProgress, onCancel, apiBaseUrl = AP
|
|
|
5261
5182
|
privacy: result.privacy || "full",
|
|
5262
5183
|
email: result.email || "",
|
|
5263
5184
|
apiUrl: result.apiUrl || apiBaseUrl,
|
|
5264
|
-
e2eServerKey: result.e2eServerKey
|
|
5265
|
-
effectiveConfig: parseEffectivePairingConfig(result.effectiveConfig)
|
|
5185
|
+
e2eServerKey: result.e2eServerKey
|
|
5266
5186
|
};
|
|
5267
5187
|
}
|
|
5268
5188
|
if (result.status === "expired") {
|
|
@@ -6360,7 +6280,7 @@ function removePiPluginViaCli() {
|
|
|
6360
6280
|
};
|
|
6361
6281
|
}
|
|
6362
6282
|
}
|
|
6363
|
-
var HERMES_BUNDLE_SHA256 = "
|
|
6283
|
+
var HERMES_BUNDLE_SHA256 = "f0013d5a39281e9faa8ffe9ebfac0f40eb1777ef971f0cd0e55d6ebf9cf44244";
|
|
6364
6284
|
var HERMES_BUNDLE_FILENAME = `agentapprove-hermes-${HERMES_PLUGIN_VERSION}.tar.gz`;
|
|
6365
6285
|
var HERMES_PLUGIN_DIR = join3(homedir(), ".hermes", "plugins", "agentapprove");
|
|
6366
6286
|
function findPython() {
|
|
@@ -6637,6 +6557,7 @@ function stageHermesBundle(bytes, targetDir) {
|
|
|
6637
6557
|
}
|
|
6638
6558
|
function enableHermesPluginForProfile(profile) {
|
|
6639
6559
|
try {
|
|
6560
|
+
ensureHermesHookTimeout(profile);
|
|
6640
6561
|
enableHermesFollowUp(profile);
|
|
6641
6562
|
runHostCommand("hermes", [...profile === HERMES_DEFAULT_PROFILE ? [] : ["-p", profile], "plugins", "enable", "agentapprove"], { interactive: true, timeoutMs: PACKAGE_INSTALL_TIMEOUT_MS });
|
|
6642
6563
|
return { success: true };
|
|
@@ -7200,7 +7121,6 @@ Monitor activity, enforce policy, and approve with a tap.`, "About");
|
|
|
7200
7121
|
const hooksDir = join3(getAgentApproveDir(), "hooks");
|
|
7201
7122
|
const selectedInstallConfig = getInitialInstallConfig(setupProfile, existingConfig);
|
|
7202
7123
|
let token = null;
|
|
7203
|
-
let pairingOutcome = null;
|
|
7204
7124
|
let finalPrivacy = selectedInstallConfig.privacy;
|
|
7205
7125
|
let email = "";
|
|
7206
7126
|
let apiUrl = pairingApiBase;
|
|
@@ -7448,20 +7368,10 @@ Monitor activity, enforce policy, and approve with a tap.`, "About");
|
|
|
7448
7368
|
he("Installation cancelled");
|
|
7449
7369
|
process.exit(0);
|
|
7450
7370
|
} else if (result) {
|
|
7451
|
-
pairingOutcome = reconcilePairingConfig(pairingConfig, result.effectiveConfig, {
|
|
7452
|
-
reportedPrivacy: result.privacy,
|
|
7453
|
-
localE2eOn: existingConfig?.e2eEnabled !== false && existsSync5(existingKeyPath)
|
|
7454
|
-
});
|
|
7455
|
-
if (pairingOutcome.encryptionRequired) {
|
|
7456
|
-
pairingSpinner.stop("Paired, but this computer is not set up");
|
|
7457
|
-
v2.error(formatEncryptionRequiredMessage("install"));
|
|
7458
|
-
he("Setup is not finished.");
|
|
7459
|
-
process.exit(1);
|
|
7460
|
-
}
|
|
7461
7371
|
token = result.token;
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7372
|
+
if (["minimal", "summary", "full"].includes(result.privacy)) {
|
|
7373
|
+
finalPrivacy = result.privacy;
|
|
7374
|
+
}
|
|
7465
7375
|
email = result.email;
|
|
7466
7376
|
apiUrl = result.apiUrl || pairingApiBase;
|
|
7467
7377
|
if (backupOldKeyTo) {
|
|
@@ -7490,12 +7400,6 @@ Monitor activity, enforce policy, and approve with a tap.`, "About");
|
|
|
7490
7400
|
}
|
|
7491
7401
|
const connectedMsg = email ? `Connected! Account: ${email}, Privacy: ${finalPrivacy}` : `Connected! Privacy: ${finalPrivacy}`;
|
|
7492
7402
|
pairingSpinner.stop(connectedMsg);
|
|
7493
|
-
const keptWarning = formatAccountKeptWarning(pairingOutcome);
|
|
7494
|
-
if (keptWarning)
|
|
7495
|
-
v2.warn(keptWarning);
|
|
7496
|
-
const unknownNote = formatAccountUnknownNote(pairingOutcome);
|
|
7497
|
-
if (unknownNote)
|
|
7498
|
-
v2.info(unknownNote);
|
|
7499
7403
|
} else {
|
|
7500
7404
|
pairingSpinner.stop("Session expired");
|
|
7501
7405
|
he("Session expired. Please try again.");
|
|
@@ -7519,8 +7423,8 @@ Monitor activity, enforce policy, and approve with a tap.`, "About");
|
|
|
7519
7423
|
privacy: finalPrivacy,
|
|
7520
7424
|
retentionDays,
|
|
7521
7425
|
debugLog,
|
|
7522
|
-
configSetAt: installPreservation.letAccountWin
|
|
7523
|
-
e2eEnabled:
|
|
7426
|
+
configSetAt: installPreservation.letAccountWin ? 0 : configSetAt,
|
|
7427
|
+
e2eEnabled: useE2E,
|
|
7524
7428
|
failBehavior,
|
|
7525
7429
|
preserved: installPreservation.preserved
|
|
7526
7430
|
});
|
|
@@ -7730,7 +7634,9 @@ Timestamped backups will be created.`);
|
|
|
7730
7634
|
` + ` 5. pip install --user cryptography httpx
|
|
7731
7635
|
` + ` (uv-managed Python: uv pip install --system --break-system-packages --python $(which python3.12) cryptography httpx)
|
|
7732
7636
|
` + ` 6. hermes config set plugins.entries.agentapprove.allow_gateway_injection true
|
|
7733
|
-
` + ` 7. hermes plugins
|
|
7637
|
+
` + ` 7. hermes config set plugins.hook_callback_timeout 600
|
|
7638
|
+
` + ` (For a named profile add -p <profile> after hermes; skip if already 0/unlimited.)
|
|
7639
|
+
` + ` 8. hermes plugins enable agentapprove
|
|
7734
7640
|
` + ` Then re-run: npx agentapprove`);
|
|
7735
7641
|
} else if (result.error) {
|
|
7736
7642
|
v2.warn(`${agent.name} was not set up.
|
|
@@ -8977,18 +8883,9 @@ async function pairCommand() {
|
|
|
8977
8883
|
v2.error('Session expired. Run "npx agentapprove pair" to try again.');
|
|
8978
8884
|
process.exit(1);
|
|
8979
8885
|
}
|
|
8980
|
-
const pairOutcome = reconcilePairingConfig(pairingConfig, result.effectiveConfig, {
|
|
8981
|
-
reportedPrivacy: result.privacy,
|
|
8982
|
-
localE2eOn: existingConfig?.e2eEnabled !== false && keys.some((k) => k.isCurrent)
|
|
8983
|
-
});
|
|
8984
|
-
if (pairOutcome.encryptionRequired) {
|
|
8985
|
-
pairingSpinner.stop("Paired, but this computer is not set up");
|
|
8986
|
-
v2.error(formatEncryptionRequiredMessage("pair"));
|
|
8987
|
-
he("Pairing is not finished.");
|
|
8988
|
-
process.exit(1);
|
|
8989
|
-
}
|
|
8990
8886
|
pairingSpinner.stop(`Paired! ${result.email ? `Account: ${result.email}` : ""}`);
|
|
8991
|
-
|
|
8887
|
+
if (keyPlan.kind === "generate")
|
|
8888
|
+
ensureAgentApproveDir();
|
|
8992
8889
|
const keyResult = applyPairKeyPlan(keyPlan, getAgentApproveDir(), {
|
|
8993
8890
|
serverKey: result.e2eServerKey,
|
|
8994
8891
|
rotation: { read: readRotationConfig, write: writeRotationConfig },
|
|
@@ -9008,22 +8905,16 @@ async function pairCommand() {
|
|
|
9008
8905
|
saveEnvConfig({
|
|
9009
8906
|
apiUrl,
|
|
9010
8907
|
token: result.token,
|
|
9011
|
-
privacy:
|
|
9012
|
-
retentionDays:
|
|
8908
|
+
privacy: existingConfig?.privacy || result.privacy || "full",
|
|
8909
|
+
retentionDays: existingConfig?.retentionDays ?? 30,
|
|
9013
8910
|
debugLog: existingConfig?.debugLog,
|
|
9014
8911
|
e2eMode: existingConfig?.e2eMode,
|
|
9015
|
-
e2eEnabled:
|
|
9016
|
-
failBehavior:
|
|
9017
|
-
configSetAt: pairPreservation.letAccountWin
|
|
8912
|
+
e2eEnabled: !!e2eUserKey,
|
|
8913
|
+
failBehavior: existingConfig?.failBehavior || "ask",
|
|
8914
|
+
configSetAt: pairPreservation.letAccountWin ? 0 : configSetAt,
|
|
9018
8915
|
preserved: pairPreservation.preserved
|
|
9019
8916
|
});
|
|
9020
8917
|
await storeTokenInKeychain(result.token);
|
|
9021
|
-
const pairKeptWarning = formatAccountKeptWarning(pairOutcome);
|
|
9022
|
-
if (pairKeptWarning)
|
|
9023
|
-
v2.warn(pairKeptWarning);
|
|
9024
|
-
const pairUnknownNote = formatAccountUnknownNote(pairOutcome);
|
|
9025
|
-
if (pairUnknownNote)
|
|
9026
|
-
v2.info(pairUnknownNote);
|
|
9027
8918
|
const hooksDir = join3(getAgentApproveDir(), "hooks");
|
|
9028
8919
|
if (existsSync5(hooksDir)) {
|
|
9029
8920
|
const updateSpinner = _2();
|