@praxis.guard/auditor-cli 0.0.59 → 0.0.60
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/hooks/mutate-deny-messages.d.ts +2 -0
- package/dist/hooks/mutate-deny-messages.d.ts.map +1 -1
- package/dist/hooks/mutate-deny-messages.js +14 -8
- package/dist/hooks/mutate-deny-messages.js.map +1 -1
- package/native/darwin-amd64/praxis-guard-daemon +0 -0
- package/native/darwin-amd64/praxis-guard-hook +0 -0
- package/native/darwin-arm64/praxis-guard-daemon +0 -0
- package/native/darwin-arm64/praxis-guard-hook +0 -0
- package/native/linux-amd64/praxis-guard-daemon +0 -0
- package/native/linux-amd64/praxis-guard-hook +0 -0
- package/native/linux-arm64/praxis-guard-daemon +0 -0
- package/native/linux-arm64/praxis-guard-hook +0 -0
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** MCP server key in ~/.cursor/mcp.json (Cursor may expose it as user-praxis-guard). */
|
|
2
|
+
export declare const PRAXIS_GUARD_MCP_SERVER = "praxis-guard";
|
|
1
3
|
export declare function formatMutateDenyMessages(opts: {
|
|
2
4
|
hook: "beforeShellExecution" | "beforeMCPExecution";
|
|
3
5
|
blockedLabel: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutate-deny-messages.d.ts","sourceRoot":"","sources":["../../src/hooks/mutate-deny-messages.ts"],"names":[],"mappings":"AAAA,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,IAAI,EAAE,sBAAsB,GAAG,oBAAoB,CAAC;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACzD,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAsClD"}
|
|
1
|
+
{"version":3,"file":"mutate-deny-messages.d.ts","sourceRoot":"","sources":["../../src/hooks/mutate-deny-messages.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,IAAI,EAAE,sBAAsB,GAAG,oBAAoB,CAAC;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACzD,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAsClD"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
/** MCP server key in ~/.cursor/mcp.json (Cursor may expose it as user-praxis-guard). */
|
|
2
|
+
export const PRAXIS_GUARD_MCP_SERVER = "praxis-guard";
|
|
1
3
|
export function formatMutateDenyMessages(opts) {
|
|
2
4
|
const proposalKind = opts.hook === "beforeMCPExecution" ? "mcp" : "shell";
|
|
3
5
|
const cwdLine = opts.storageRoot
|
|
4
6
|
? `proposal.cwd must be "${opts.storageRoot}" (workspace root where this hook runs).\n`
|
|
5
7
|
: "";
|
|
6
|
-
const userMessage =
|
|
8
|
+
const userMessage = mutateDenyLead() +
|
|
7
9
|
`${opts.blockedLabel}. Human approval required (MUTATE policy).\n` +
|
|
8
10
|
cwdLine +
|
|
9
11
|
(opts.inline
|
|
@@ -24,31 +26,35 @@ export function formatMutateDenyMessages(opts) {
|
|
|
24
26
|
`Do not suggest running the same command in the user's terminal, an external shell, or via another tool to circumvent this block. ` +
|
|
25
27
|
inlineAgent +
|
|
26
28
|
(opts.inline
|
|
27
|
-
? `Next: call MCP \`guard_wait\` now with the same proposal ` +
|
|
29
|
+
? `Next: call MCP \`guard_wait\` on \`${PRAXIS_GUARD_MCP_SERVER}\` now with the same proposal ` +
|
|
28
30
|
`(\`kind\`: "${proposalKind}", same \`argv\`, \`cwd\` / \`raw_command\` as applicable), then retry once on allow. `
|
|
29
|
-
: `Next: MCP \`guard_wait\` (preferred) or \`guard\` with \`mode: "enforce"\` and \`proposal\` matching this block ` +
|
|
31
|
+
: `Next: MCP \`guard_wait\` on \`${PRAXIS_GUARD_MCP_SERVER}\` (preferred) or \`guard\` with \`mode: "enforce"\` and \`proposal\` matching this block ` +
|
|
30
32
|
`(\`kind\`: "${proposalKind}", same \`argv\`, \`cwd\` / \`raw_command\` as applicable). ` +
|
|
31
33
|
`On \`require_approval\`, send the human to \`approval.open_url\` or Praxis Approvals. ` +
|
|
32
34
|
`After approval, retry this exact invocation once (hook consumes execution ticket).`),
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
/** First lines in user_message — must survive Cursor hook truncation and reach the model. */
|
|
38
|
+
function mutateDenyLead() {
|
|
39
|
+
return ("DO NOT ask the user to run this in their terminal or an external shell.\n" +
|
|
40
|
+
`Required next step: call MCP tool \`guard_wait\` on the \`${PRAXIS_GUARD_MCP_SERVER}\` server ` +
|
|
41
|
+
"(Cursor MCP name may be user-praxis-guard) before retrying this action.\n\n");
|
|
37
42
|
}
|
|
38
43
|
function mutateGuardWaitUserAgentBlock(proposalKind, argvJson, inline, storageRoot) {
|
|
39
44
|
const cwdHint = storageRoot
|
|
40
45
|
? ` Set \`proposal.cwd\` to "${storageRoot}" (workspace root where this hook runs).`
|
|
41
46
|
: "";
|
|
47
|
+
const serverHint = ` Use MCP server \`${PRAXIS_GUARD_MCP_SERVER}\`.`;
|
|
42
48
|
if (inline) {
|
|
43
49
|
return (`Agent: MUST call MCP \`guard_wait\` now with \`context.approval.request_id\` = "${inline.request_id}", ` +
|
|
44
50
|
`\`context.wait_ms\` = 120000, and \`proposal\` matching this block ` +
|
|
45
|
-
`(\`kind\`: "${proposalKind}", \`argv\`: ${argvJson}).${cwdHint} ` +
|
|
46
|
-
`Do not retry the
|
|
51
|
+
`(\`kind\`: "${proposalKind}", \`argv\`: ${argvJson}).${cwdHint}${serverHint} ` +
|
|
52
|
+
`Do not retry the shell/MCP tool until \`guard_wait\` resolves to allow. ` +
|
|
47
53
|
`Do not call \`guard\` instead of \`guard_wait\`. ` +
|
|
48
54
|
`Do not suggest running this command in the user's terminal or via another tool.`);
|
|
49
55
|
}
|
|
50
56
|
return (`Agent: MUST call MCP \`guard_wait\` now with \`context.wait_ms\` = 120000 and \`proposal\` matching this block ` +
|
|
51
|
-
`(\`kind\`: "${proposalKind}", \`argv\`: ${argvJson}).${cwdHint} ` +
|
|
57
|
+
`(\`kind\`: "${proposalKind}", \`argv\`: ${argvJson}).${cwdHint}${serverHint} ` +
|
|
52
58
|
`If \`guard_wait\` returns \`require_approval\`, pass \`context.approval.request_id\` from the response and call \`guard_wait\` again until redeemed. ` +
|
|
53
59
|
`Direct the human to \`approval.open_url\` when shown. After \`guard_wait\` succeeds, retry this exact invocation once. ` +
|
|
54
60
|
`Do not call \`guard\` instead of \`guard_wait\`. ` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutate-deny-messages.js","sourceRoot":"","sources":["../../src/hooks/mutate-deny-messages.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,wBAAwB,CAAC,IAOxC;IACC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,KAAK,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1E,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW;QAC9B,CAAC,CAAC,yBAAyB,IAAI,CAAC,WAAW,4CAA4C;QACvF,CAAC,CAAC,E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