agentapprove 0.2.2 → 0.2.5
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 +44 -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,10 +3718,10 @@ 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": [
|
|
3724
|
+
"b2085bc322c989592a0da489a90a540d58a29d334f2dbdb810aec160a2f05f46",
|
|
3698
3725
|
"5850ec58a56474891627e54b4e34255a878b7d21037382296c5512ee6d250d54"
|
|
3699
3726
|
],
|
|
3700
3727
|
"claude-notification.sh": [
|
|
@@ -3707,8 +3734,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3707
3734
|
"8a61253504c99ecdf101b4fa8681a09489f128ef4ba6dcfb47450c881011654e"
|
|
3708
3735
|
],
|
|
3709
3736
|
"claude-pre-tool.sh": [
|
|
3710
|
-
"5a317ed1eb620bf5751fbe50ac266295f9a9436a5b5368ff4d5f3ae1e0202f33"
|
|
3711
|
-
"a4bae2a689b075762a11df659b10ca783c1c780af93277efe37a398243fbc8ed"
|
|
3737
|
+
"5a317ed1eb620bf5751fbe50ac266295f9a9436a5b5368ff4d5f3ae1e0202f33"
|
|
3712
3738
|
],
|
|
3713
3739
|
"claude-prompt.sh": [
|
|
3714
3740
|
"449cffbd8efb1f04f51d67aedb817883cffd20ab99ddff4eb32acfb4d3692080"
|
|
@@ -3735,8 +3761,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3735
3761
|
"b2d6a3352198a79780ace8303b476b37250d020d066d3be0b32719be34cb1198"
|
|
3736
3762
|
],
|
|
3737
3763
|
"codex-pre-tool.sh": [
|
|
3738
|
-
"6c44eb3f3774024d26a2d9162b9a91f1ac8c15559a164823f122aa0f423b454f"
|
|
3739
|
-
"3d1c6b7f8717f7b043d54f79af6225bebffb2baa4f0badde759182c415bcc343"
|
|
3764
|
+
"6c44eb3f3774024d26a2d9162b9a91f1ac8c15559a164823f122aa0f423b454f"
|
|
3740
3765
|
],
|
|
3741
3766
|
"codex-session-start.sh": [
|
|
3742
3767
|
"b14351394abeab95d047d6843e34d52e33758eef1f4f129a31efe6334858db53"
|
|
@@ -3754,19 +3779,17 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3754
3779
|
"0e8886fa08e6c5529721f6e94907c9bad6c32e97c1f4827e2ef5270f349cce4f"
|
|
3755
3780
|
],
|
|
3756
3781
|
"common.sh": [
|
|
3757
|
-
"
|
|
3758
|
-
"
|
|
3782
|
+
"2c0407f51dfe95cf1bcc6c705a268ea461ab044e2808539339ad222a2b5ade2b",
|
|
3783
|
+
"e9878d93113337bd49ccfbc34f57aed38f0f93dad77eebe5b981adfe10ef82f2"
|
|
3759
3784
|
],
|
|
3760
3785
|
"completion-hook.sh": [
|
|
3761
3786
|
"ec94b799c35cd650b79d50f223bd57e817fed5d7e379aac5948e06f14ad7b31a"
|
|
3762
3787
|
],
|
|
3763
3788
|
"cursor-approval.sh": [
|
|
3764
|
-
"66321a6409dbc77bbd9c83781b5112c4eb8e9139c62ce6e7952cb886d33ee996"
|
|
3765
|
-
"547e056485093ff9071a5c45326dfaf1320918495c54908f7413d7f6c7a9422f"
|
|
3789
|
+
"66321a6409dbc77bbd9c83781b5112c4eb8e9139c62ce6e7952cb886d33ee996"
|
|
3766
3790
|
],
|
|
3767
3791
|
"cursor-mcp-approval.sh": [
|
|
3768
|
-
"1d54625606519a8d1f763631aee8d2e9a92aede7b9619a9882174c0bc1059bb9"
|
|
3769
|
-
"e5638dde8b7767ff4e3c0a361dec27fe49fa63048ea06952bb602b98e8abb80d"
|
|
3792
|
+
"1d54625606519a8d1f763631aee8d2e9a92aede7b9619a9882174c0bc1059bb9"
|
|
3770
3793
|
],
|
|
3771
3794
|
"cursor-mcp-complete.sh": [
|
|
3772
3795
|
"0c7131db3e9007dc1e614cd5a132f08f4ee60030d48c0ee3fcb48074ae37c37b"
|
|
@@ -3775,8 +3798,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3775
3798
|
"44971e10d711667a659a493f062cadb4d44545c42aec0bbd24ad3821cfb27594"
|
|
3776
3799
|
],
|
|
3777
3800
|
"cursor-pre-tool.sh": [
|
|
3778
|
-
"41e804015779822adec39cf62efb0a71e055f83e56622612e6f39f0a80422906"
|
|
3779
|
-
"87ed62e2d5976b1c04337b2407f73f86d039751a12a3803ca2f8db1ca3a10446"
|
|
3801
|
+
"41e804015779822adec39cf62efb0a71e055f83e56622612e6f39f0a80422906"
|
|
3780
3802
|
],
|
|
3781
3803
|
"cursor-precompact.sh": [
|
|
3782
3804
|
"33faedfd07999296911aa9080a2799938493114ad29878db025d6c42db418f83"
|
|
@@ -3824,8 +3846,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3824
3846
|
"b074d767fe5e211a7f6434db1d2b02c6761df73b01f8defa703691cd1d986485"
|
|
3825
3847
|
],
|
|
3826
3848
|
"gemini-before-tool.sh": [
|
|
3827
|
-
"222623ee4dd6ddd592d8aa0bcf3553d1acda3a2543cf6528bb3cabb50d2cb593"
|
|
3828
|
-
"65c12342fd73cd200c6b6934b3742390e2f2d16524f9d643889c6b1107762ca9"
|
|
3849
|
+
"222623ee4dd6ddd592d8aa0bcf3553d1acda3a2543cf6528bb3cabb50d2cb593"
|
|
3829
3850
|
],
|
|
3830
3851
|
"gemini-notification.sh": [
|
|
3831
3852
|
"5978c5d4b689f2e87131d9950b50588a4aa74390b548a43c3ea6e607fe407e16"
|
|
@@ -3846,8 +3867,7 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3846
3867
|
"e057c5f624d7d4998ea59ef524b97b2364f860477a6aadd2512d562cdecfc6c2"
|
|
3847
3868
|
],
|
|
3848
3869
|
"github-pre-tool.sh": [
|
|
3849
|
-
"a331d5980824db7ca38a586f5f6398627b6653397eb4d5bcd19b18a293479c38"
|
|
3850
|
-
"1066e08beb1ff864a8075cf9cd77ab1b64e5913f30675edd97cbb58e5fa05a7b"
|
|
3870
|
+
"a331d5980824db7ca38a586f5f6398627b6653397eb4d5bcd19b18a293479c38"
|
|
3851
3871
|
],
|
|
3852
3872
|
"github-precompact.sh": [
|
|
3853
3873
|
"f34011aa926611fe8691ef24250ab22561ff6c0387d3e3527e52d44c7aac6f44"
|
|
@@ -3871,16 +3891,13 @@ var HOOK_SCRIPT_SHA256 = {
|
|
|
3871
3891
|
"67ac8e7c33991402cc2dfcaf6b3380ba50b92cf224fcb447c2bb39cbd7c7a1a8"
|
|
3872
3892
|
],
|
|
3873
3893
|
"notify-hook.sh": [
|
|
3874
|
-
"a222c9f656da5c9b0c6cb9998ddb6dd07608cabacef2931d542d68b04075632b"
|
|
3875
|
-
"0892b3f3b71b8f7df08917ad4f38baac1655093a38f5d43238aca49b9f0554a1"
|
|
3894
|
+
"a222c9f656da5c9b0c6cb9998ddb6dd07608cabacef2931d542d68b04075632b"
|
|
3876
3895
|
],
|
|
3877
3896
|
"openhands-hook.sh": [
|
|
3878
|
-
"28cacd77360c53fdb7b095403dfc43c7b7cf83ff718ac85f7f1a9042652bd8c0"
|
|
3879
|
-
"ebdb17e34918e6e58e9ab70e2db9521f25b1907f9cd96d78d217074db64fc566"
|
|
3897
|
+
"28cacd77360c53fdb7b095403dfc43c7b7cf83ff718ac85f7f1a9042652bd8c0"
|
|
3880
3898
|
],
|
|
3881
3899
|
"windsurf-hook.sh": [
|
|
3882
|
-
"b7e85df3b6188cd1dfd6b2eb904185e41b627e077a265eaa6bb88a804323b47d"
|
|
3883
|
-
"16a73925f6a2b2fb3a9e29166316519bb5f5afd05bbed0df80513b004434ebd8"
|
|
3900
|
+
"b7e85df3b6188cd1dfd6b2eb904185e41b627e077a265eaa6bb88a804323b47d"
|
|
3884
3901
|
]
|
|
3885
3902
|
};
|
|
3886
3903
|
|
|
@@ -4028,7 +4045,7 @@ Configured on this computer: ${ready.join(", ")}. Nothing was changed.`);
|
|
|
4028
4045
|
}
|
|
4029
4046
|
|
|
4030
4047
|
// src/cli.ts
|
|
4031
|
-
var VERSION = "0.2.
|
|
4048
|
+
var VERSION = "0.2.5";
|
|
4032
4049
|
function getApiUrl() {
|
|
4033
4050
|
return process.env.AGENTAPPROVE_API || "https://api.agentapprove.com";
|
|
4034
4051
|
}
|