@squadrant-ai/auto-gate 0.1.0 → 0.1.1

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.
@@ -2,7 +2,7 @@ export declare const OUR_MARKER = " # auto-gate-managed";
2
2
  export declare const OUR_COMMAND = "auto-gate decide --agent claude # auto-gate-managed";
3
3
  type Json = Record<string, unknown>;
4
4
  /** True when a command string is ours — matched by the marker OR by the parsed
5
- * argv basename `auto-gate`, so `npx @squadrant/auto-gate …` / `node <path> …`
5
+ * argv basename `auto-gate`, so `npx @squadrant-ai/auto-gate …` / `node <path> …`
6
6
  * forms are still recognized (§15 #5). */
7
7
  export declare function isOurCommand(command: string): boolean;
8
8
  /** Idempotent, non-clobbering: appends our handler to the PermissionRequest list. */
@@ -3,7 +3,7 @@ export const OUR_COMMAND = `auto-gate decide --agent claude${OUR_MARKER}`;
3
3
  /** squadrant's managed PermissionRequest command (exact string, #782). */
4
4
  const SQUADRANT_COMMAND = "squadrant gate claude permission-request";
5
5
  /** True when a command string is ours — matched by the marker OR by the parsed
6
- * argv basename `auto-gate`, so `npx @squadrant/auto-gate …` / `node <path> …`
6
+ * argv basename `auto-gate`, so `npx @squadrant-ai/auto-gate …` / `node <path> …`
7
7
  * forms are still recognized (§15 #5). */
8
8
  export function isOurCommand(command) {
9
9
  if (command.includes(OUR_MARKER.trim()))
@@ -3,7 +3,11 @@ const VERDICTS = ["allow", "deny", "ask"];
3
3
  /** Pure. Returns null for anything the policy engine should treat as "no usable
4
4
  * assessment" (→ ask): a near-tie, a missing/malformed Choice, or no confidence. */
5
5
  export function parseJevResponse(raw, model, askedIds) {
6
- const d = raw.decision;
6
+ // TypeSafe's wire shape nests the answers under an `answers` envelope
7
+ // (e.g. { model, answers: { decision, ... }, usage }). Fall back to the
8
+ // top-level shape for callers/fixtures that pass answers directly.
9
+ const answers = raw.answers ?? raw;
10
+ const d = answers.decision;
7
11
  if (!d || typeof d.choice !== "string" || !VERDICTS.includes(d.choice))
8
12
  return null;
9
13
  if (typeof d.confidence !== "number")
@@ -17,11 +21,11 @@ export function parseJevResponse(raw, model, askedIds) {
17
21
  for (const id of ["destructive", "secrets", "scope_escape", "intent_match"]) {
18
22
  if (!askedIds.includes(id))
19
23
  continue;
20
- const noul = raw[id]?.noul;
24
+ const noul = answers[id]?.noul;
21
25
  if (typeof noul === "number")
22
26
  hazards[id] = noul;
23
27
  }
24
- const sevAnswer = raw.severity;
28
+ const sevAnswer = answers.severity;
25
29
  const severity = typeof sevAnswer?.score === "number" ? sevAnswer.score : undefined;
26
30
  return {
27
31
  verdict: d.choice,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squadrant-ai/auto-gate",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Provider-agnostic auto permission gate",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",