@cookiepal-oss/agent 0.2.0 → 0.2.2
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/README.md +1 -1
- package/dist/check.mjs +16 -11
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npx needs no plugin folder, which is the point: Codex and Cursor never tell a sk
|
|
|
14
14
|
|
|
15
15
|
## Where it keeps its files
|
|
16
16
|
|
|
17
|
-
In Claude Code, `COOKIEPAL_DATA_DIR`, which the plugin
|
|
17
|
+
In Claude Code, `COOKIEPAL_DATA_DIR`, which the plugin's skills set to its data folder, or else the `CLAUDE_PLUGIN_DATA` that Claude Code exports to the plugin's hooks; the check refuses to run without either. Codex's hooks always use `~/.cookiepal/plugin-data`, whatever `COOKIEPAL_DATA_DIR` says, so they share one folder with the skills. Everywhere else, `COOKIEPAL_DATA_DIR` when it is set, and `~/.cookiepal/plugin-data` when it is empty or unset.
|
|
18
18
|
|
|
19
19
|
## Cursor's hooks
|
|
20
20
|
|
package/dist/check.mjs
CHANGED
|
@@ -1342,13 +1342,17 @@ var normalizeHookPayload = (raw, env) => {
|
|
|
1342
1342
|
};
|
|
1343
1343
|
};
|
|
1344
1344
|
var toolOf = (payload) => typeof payload.tool_name === "string" ? payload.tool_name.split("__").at(-1) ?? "" : "";
|
|
1345
|
-
var
|
|
1345
|
+
var cursorDecision = (permission, reason) => JSON.stringify({ permission, user_message: reason, agent_message: reason });
|
|
1346
1346
|
var decisionOutput = (client, permission, reason) => {
|
|
1347
|
-
if (client === "cursor")
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1347
|
+
if (client === "cursor") return cursorDecision(permission, reason);
|
|
1348
|
+
if (client === "codex" && permission === "ask") return null;
|
|
1349
|
+
return JSON.stringify({
|
|
1350
|
+
hookSpecificOutput: {
|
|
1351
|
+
hookEventName: "PreToolUse",
|
|
1352
|
+
permissionDecision: permission,
|
|
1353
|
+
permissionDecisionReason: reason
|
|
1354
|
+
}
|
|
1355
|
+
});
|
|
1352
1356
|
};
|
|
1353
1357
|
var CURSOR_ALLOW = JSON.stringify({ permission: "allow" });
|
|
1354
1358
|
|
|
@@ -1361,7 +1365,7 @@ var LAUNCHER = /[\\/]cookiepal-hook\.(?:sh|cmd)"/;
|
|
|
1361
1365
|
var EARLIER_COPY = /[\\/]\.cookiepal[\\/]agent[\\/]/;
|
|
1362
1366
|
var launcherFile = (paths) => join3(dirname(paths.hooksFile), isWindows(paths) ? "cookiepal-hook.cmd" : "cookiepal-hook.sh");
|
|
1363
1367
|
var NO_NODE_REASON = "CookiePal could not find Node.js 18 or later to check this call, so it was stopped. Run a CookiePal check to repair the CookiePal hooks.";
|
|
1364
|
-
var NO_NODE_DENY =
|
|
1368
|
+
var NO_NODE_DENY = cursorDecision("deny", NO_NODE_REASON);
|
|
1365
1369
|
var NODE_18_OR_LATER = "process.exit(+process.versions.node.split('.')[0] >= 18 ? 0 : 1)";
|
|
1366
1370
|
var POSIX_NODES = [
|
|
1367
1371
|
'"$(command -v node 2>/dev/null)"',
|
|
@@ -2803,12 +2807,12 @@ var pluginVersion = () => {
|
|
|
2803
2807
|
const manifest = new URL("../.claude-plugin/plugin.json", import.meta.url);
|
|
2804
2808
|
return JSON.parse(readFileSync6(manifest, "utf8")).version ?? null;
|
|
2805
2809
|
} catch {
|
|
2806
|
-
return true ? "0.2.
|
|
2810
|
+
return true ? "0.2.2" : null;
|
|
2807
2811
|
}
|
|
2808
2812
|
};
|
|
2809
2813
|
var HOME_DATA_DIR = join6(homedir(), ".cookiepal", "plugin-data");
|
|
2810
2814
|
var resolveDataDir = (env) => {
|
|
2811
|
-
const given = env.COOKIEPAL_DATA_DIR;
|
|
2815
|
+
const given = env.COOKIEPAL_DATA_DIR || env.CLAUDE_PLUGIN_DATA;
|
|
2812
2816
|
if (env.PLUGIN_ROOT) return HOME_DATA_DIR;
|
|
2813
2817
|
if (given) return given;
|
|
2814
2818
|
return env.CLAUDECODE === "1" ? null : HOME_DATA_DIR;
|
|
@@ -3231,7 +3235,7 @@ var cursorHookPaths = () => ({
|
|
|
3231
3235
|
agentDir: join6(homedir(), ".cookiepal", "agent"),
|
|
3232
3236
|
distDir: fileURLToPath(new URL(".", import.meta.url)),
|
|
3233
3237
|
node: process.execPath,
|
|
3234
|
-
version: true ? "0.2.
|
|
3238
|
+
version: true ? "0.2.2" : "dev"
|
|
3235
3239
|
});
|
|
3236
3240
|
var cursorHooks = (action) => {
|
|
3237
3241
|
const paths = cursorHookPaths();
|
|
@@ -3289,7 +3293,8 @@ var GUARD_REASON = "plan_check takes only a page as the check's prepare step ret
|
|
|
3289
3293
|
var GUARD_ID_REASON = "plan_check may carry an installId only while the user is sharing it, and only the one prepare returned. Sharing has stopped or the ID is not this machine's, so leave installId out.";
|
|
3290
3294
|
var decide = (permission, reason) => {
|
|
3291
3295
|
decided = true;
|
|
3292
|
-
|
|
3296
|
+
const output2 = decisionOutput(hookClient, permission, reason);
|
|
3297
|
+
if (output2 !== null) process.stdout.write(`${output2}
|
|
3293
3298
|
`);
|
|
3294
3299
|
};
|
|
3295
3300
|
var deny = (reason = GUARD_REASON) => decide("deny", reason);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cookiepal-oss/agent",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"tldts": "7.4.18",
|
|
27
27
|
"typescript": "^5.0.0",
|
|
28
28
|
"vitest": "^3.0.0",
|
|
29
|
-
"@cookiepal-oss/
|
|
30
|
-
"@cookiepal-oss/
|
|
29
|
+
"@cookiepal-oss/integrations": "1.2.0",
|
|
30
|
+
"@cookiepal-oss/cookie-db": "1.0.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "node scripts/build.ts",
|