agentapprove 0.2.2 → 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 +43 -27
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2212,6 +2212,28 @@ function runOpenClaw(args) {
|
|
|
2212
2212
|
const result = spawnSync("openclaw", args, { stdio: "inherit", shell: process.platform === "win32" });
|
|
2213
2213
|
return !result.error && result.status === 0;
|
|
2214
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
|
+
}
|
|
2215
2237
|
function mergeOpenClawConfig(config, conversationAccess) {
|
|
2216
2238
|
const plugins = config.plugins ?? {};
|
|
2217
2239
|
const entries = plugins.entries ?? {};
|
|
@@ -2241,6 +2263,7 @@ async function installOpenClaw(options) {
|
|
|
2241
2263
|
return fail("Could not read OpenClaw configuration as JSON. No plugin installation or permission changes were made. Check the config before retrying.");
|
|
2242
2264
|
}
|
|
2243
2265
|
const installed = options.readVersion();
|
|
2266
|
+
let installedThisRun = false;
|
|
2244
2267
|
if (installed !== options.version) {
|
|
2245
2268
|
const args = ["plugins", "install", options.spec];
|
|
2246
2269
|
if (installed !== null) {
|
|
@@ -2254,17 +2277,21 @@ async function installOpenClaw(options) {
|
|
|
2254
2277
|
const actual = options.readVersion();
|
|
2255
2278
|
if (actual !== options.version)
|
|
2256
2279
|
return fail(`OpenClaw installed ${actual ?? "an unverified version"}, expected ${options.version}.`);
|
|
2280
|
+
installedThisRun = true;
|
|
2257
2281
|
}
|
|
2282
|
+
let configChanged = false;
|
|
2258
2283
|
try {
|
|
2259
2284
|
const current = options.readConfig();
|
|
2260
2285
|
const updated = mergeOpenClawConfig(current, true);
|
|
2261
|
-
|
|
2286
|
+
configChanged = !isDeepStrictEqual(current, updated);
|
|
2287
|
+
if (configChanged)
|
|
2262
2288
|
options.writeConfig(updated);
|
|
2263
2289
|
} catch {
|
|
2264
2290
|
return fail("Could not read or save OpenClaw configuration. The plugin package is present; check the config and retry setup before using it.");
|
|
2265
2291
|
}
|
|
2266
2292
|
const action = options.mode === "approval" ? "enable" : "disable";
|
|
2267
|
-
|
|
2293
|
+
const alreadyApplied = action === "enable" && installedThisRun && !configChanged && (options.readActive ?? readOpenClawActive)(options.version);
|
|
2294
|
+
if (!alreadyApplied && !run(["plugins", action, "openclaw"]))
|
|
2268
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.`);
|
|
2269
2296
|
return {
|
|
2270
2297
|
success: true,
|
|
@@ -3691,8 +3718,7 @@ async function copyHookScripts(hooksDir, token, files, options) {
|
|
|
3691
3718
|
// src/hook-manifest.generated.ts
|
|
3692
3719
|
var HOOK_SCRIPT_SHA256 = {
|
|
3693
3720
|
"antigravity-hook.sh": [
|
|
3694
|
-
"1f096235ba308087ad578aabdf2217f3e4f8ba336626ef2b70188f8dd2f24ac9"
|
|
3695
|
-
"1ed82442099b7216b9dd3fd6b1e9f2648b5230b528778a374ba7f1d570603d8a"
|
|
3721
|
+
"1f096235ba308087ad578aabdf2217f3e4f8ba336626ef2b70188f8dd2f24ac9"
|
|
3696
3722
|
],
|
|
3697
3723
|
"background-filter.js": [
|
|
3698
3724
|
"5850ec58a56474891627e54b4e34255a878b7d21037382296c5512ee6d250d54"
|
|
@@ -3707,8 +3733,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3707
3733
|
"8a61253504c99ecdf101b4fa8681a09489f128ef4ba6dcfb47450c881011654e"
|
|
3708
3734
|
],
|
|
3709
3735
|
"claude-pre-tool.sh": [
|
|
3710
|
-
"5a317ed1eb620bf5751fbe50ac266295f9a9436a5b5368ff4d5f3ae1e0202f33"
|
|
3711
|
-
"a4bae2a689b075762a11df659b10ca783c1c780af93277efe37a398243fbc8ed"
|
|
3736
|
+
"5a317ed1eb620bf5751fbe50ac266295f9a9436a5b5368ff4d5f3ae1e0202f33"
|
|
3712
3737
|
],
|
|
3713
3738
|
"claude-prompt.sh": [
|
|
3714
3739
|
"449cffbd8efb1f04f51d67aedb817883cffd20ab99ddff4eb32acfb4d3692080"
|
|
@@ -3735,8 +3760,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3735
3760
|
"b2d6a3352198a79780ace8303b476b37250d020d066d3be0b32719be34cb1198"
|
|
3736
3761
|
],
|
|
3737
3762
|
"codex-pre-tool.sh": [
|
|
3738
|
-
"6c44eb3f3774024d26a2d9162b9a91f1ac8c15559a164823f122aa0f423b454f"
|
|
3739
|
-
"3d1c6b7f8717f7b043d54f79af6225bebffb2baa4f0badde759182c415bcc343"
|
|
3763
|
+
"6c44eb3f3774024d26a2d9162b9a91f1ac8c15559a164823f122aa0f423b454f"
|
|
3740
3764
|
],
|
|
3741
3765
|
"codex-session-start.sh": [
|
|
3742
3766
|
"b14351394abeab95d047d6843e34d52e33758eef1f4f129a31efe6334858db53"
|
|
@@ -3754,19 +3778,17 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3754
3778
|
"0e8886fa08e6c5529721f6e94907c9bad6c32e97c1f4827e2ef5270f349cce4f"
|
|
3755
3779
|
],
|
|
3756
3780
|
"common.sh": [
|
|
3757
|
-
"
|
|
3758
|
-
"
|
|
3781
|
+
"2c0407f51dfe95cf1bcc6c705a268ea461ab044e2808539339ad222a2b5ade2b",
|
|
3782
|
+
"e9878d93113337bd49ccfbc34f57aed38f0f93dad77eebe5b981adfe10ef82f2"
|
|
3759
3783
|
],
|
|
3760
3784
|
"completion-hook.sh": [
|
|
3761
3785
|
"ec94b799c35cd650b79d50f223bd57e817fed5d7e379aac5948e06f14ad7b31a"
|
|
3762
3786
|
],
|
|
3763
3787
|
"cursor-approval.sh": [
|
|
3764
|
-
"66321a6409dbc77bbd9c83781b5112c4eb8e9139c62ce6e7952cb886d33ee996"
|
|
3765
|
-
"547e056485093ff9071a5c45326dfaf1320918495c54908f7413d7f6c7a9422f"
|
|
3788
|
+
"66321a6409dbc77bbd9c83781b5112c4eb8e9139c62ce6e7952cb886d33ee996"
|
|
3766
3789
|
],
|
|
3767
3790
|
"cursor-mcp-approval.sh": [
|
|
3768
|
-
"1d54625606519a8d1f763631aee8d2e9a92aede7b9619a9882174c0bc1059bb9"
|
|
3769
|
-
"e5638dde8b7767ff4e3c0a361dec27fe49fa63048ea06952bb602b98e8abb80d"
|
|
3791
|
+
"1d54625606519a8d1f763631aee8d2e9a92aede7b9619a9882174c0bc1059bb9"
|
|
3770
3792
|
],
|
|
3771
3793
|
"cursor-mcp-complete.sh": [
|
|
3772
3794
|
"0c7131db3e9007dc1e614cd5a132f08f4ee60030d48c0ee3fcb48074ae37c37b"
|
|
@@ -3775,8 +3797,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3775
3797
|
"44971e10d711667a659a493f062cadb4d44545c42aec0bbd24ad3821cfb27594"
|
|
3776
3798
|
],
|
|
3777
3799
|
"cursor-pre-tool.sh": [
|
|
3778
|
-
"41e804015779822adec39cf62efb0a71e055f83e56622612e6f39f0a80422906"
|
|
3779
|
-
"87ed62e2d5976b1c04337b2407f73f86d039751a12a3803ca2f8db1ca3a10446"
|
|
3800
|
+
"41e804015779822adec39cf62efb0a71e055f83e56622612e6f39f0a80422906"
|
|
3780
3801
|
],
|
|
3781
3802
|
"cursor-precompact.sh": [
|
|
3782
3803
|
"33faedfd07999296911aa9080a2799938493114ad29878db025d6c42db418f83"
|
|
@@ -3824,8 +3845,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3824
3845
|
"b074d767fe5e211a7f6434db1d2b02c6761df73b01f8defa703691cd1d986485"
|
|
3825
3846
|
],
|
|
3826
3847
|
"gemini-before-tool.sh": [
|
|
3827
|
-
"222623ee4dd6ddd592d8aa0bcf3553d1acda3a2543cf6528bb3cabb50d2cb593"
|
|
3828
|
-
"65c12342fd73cd200c6b6934b3742390e2f2d16524f9d643889c6b1107762ca9"
|
|
3848
|
+
"222623ee4dd6ddd592d8aa0bcf3553d1acda3a2543cf6528bb3cabb50d2cb593"
|
|
3829
3849
|
],
|
|
3830
3850
|
"gemini-notification.sh": [
|
|
3831
3851
|
"5978c5d4b689f2e87131d9950b50588a4aa74390b548a43c3ea6e607fe407e16"
|
|
@@ -3846,8 +3866,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3846
3866
|
"e057c5f624d7d4998ea59ef524b97b2364f860477a6aadd2512d562cdecfc6c2"
|
|
3847
3867
|
],
|
|
3848
3868
|
"github-pre-tool.sh": [
|
|
3849
|
-
"a331d5980824db7ca38a586f5f6398627b6653397eb4d5bcd19b18a293479c38"
|
|
3850
|
-
"1066e08beb1ff864a8075cf9cd77ab1b64e5913f30675edd97cbb58e5fa05a7b"
|
|
3869
|
+
"a331d5980824db7ca38a586f5f6398627b6653397eb4d5bcd19b18a293479c38"
|
|
3851
3870
|
],
|
|
3852
3871
|
"github-precompact.sh": [
|
|
3853
3872
|
"f34011aa926611fe8691ef24250ab22561ff6c0387d3e3527e52d44c7aac6f44"
|
|
@@ -3871,16 +3890,13 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3871
3890
|
"67ac8e7c33991402cc2dfcaf6b3380ba50b92cf224fcb447c2bb39cbd7c7a1a8"
|
|
3872
3891
|
],
|
|
3873
3892
|
"notify-hook.sh": [
|
|
3874
|
-
"a222c9f656da5c9b0c6cb9998ddb6dd07608cabacef2931d542d68b04075632b"
|
|
3875
|
-
"0892b3f3b71b8f7df08917ad4f38baac1655093a38f5d43238aca49b9f0554a1"
|
|
3893
|
+
"a222c9f656da5c9b0c6cb9998ddb6dd07608cabacef2931d542d68b04075632b"
|
|
3876
3894
|
],
|
|
3877
3895
|
"openhands-hook.sh": [
|
|
3878
|
-
"28cacd77360c53fdb7b095403dfc43c7b7cf83ff718ac85f7f1a9042652bd8c0"
|
|
3879
|
-
"ebdb17e34918e6e58e9ab70e2db9521f25b1907f9cd96d78d217074db64fc566"
|
|
3896
|
+
"28cacd77360c53fdb7b095403dfc43c7b7cf83ff718ac85f7f1a9042652bd8c0"
|
|
3880
3897
|
],
|
|
3881
3898
|
"windsurf-hook.sh": [
|
|
3882
|
-
"b7e85df3b6188cd1dfd6b2eb904185e41b627e077a265eaa6bb88a804323b47d"
|
|
3883
|
-
"16a73925f6a2b2fb3a9e29166316519bb5f5afd05bbed0df80513b004434ebd8"
|
|
3899
|
+
"b7e85df3b6188cd1dfd6b2eb904185e41b627e077a265eaa6bb88a804323b47d"
|
|
3884
3900
|
]
|
|
3885
3901
|
};
|
|
3886
3902
|
|
|
@@ -4028,7 +4044,7 @@ Configured on this computer: ${ready.join(", ")}. Nothing was changed.`);
|
|
|
4028
4044
|
}
|
|
4029
4045
|
|
|
4030
4046
|
// src/cli.ts
|
|
4031
|
-
var VERSION = "0.2.
|
|
4047
|
+
var VERSION = "0.2.4";
|
|
4032
4048
|
function getApiUrl() {
|
|
4033
4049
|
return process.env.AGENTAPPROVE_API || "https://api.agentapprove.com";
|
|
4034
4050
|
}
|