alnair-sdk 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.
package/dist/index.d.ts CHANGED
@@ -73,7 +73,7 @@ export declare const alnair: {
73
73
  }>;
74
74
  configure: (config: AlnairConfig) => void;
75
75
  };
76
- export { prettyAgent, prettyAction, prettyProvider, parsePermission, displayPermission, formatMintNotice, shouldNotify, streamMintNotice, } from "./notify.js";
76
+ export { prettyAgent, prettyAction, prettyProvider, parsePermission, displayPermission, formatMintNotice, grantNoticeLine, shouldNotify, streamMintNotice, } from "./notify.js";
77
77
  export { mark, markGlyph, MARK } from "./mark.js";
78
78
  export type { MarkState } from "./mark.js";
79
79
  export { detectRunningAgent } from "./agent.js";
package/dist/index.js CHANGED
@@ -227,7 +227,7 @@ export const alnair = {
227
227
  _default = new AlnairClient(config);
228
228
  },
229
229
  };
230
- export { prettyAgent, prettyAction, prettyProvider, parsePermission, displayPermission, formatMintNotice, shouldNotify, streamMintNotice, } from "./notify.js";
230
+ export { prettyAgent, prettyAction, prettyProvider, parsePermission, displayPermission, formatMintNotice, grantNoticeLine, shouldNotify, streamMintNotice, } from "./notify.js";
231
231
  export { mark, markGlyph, MARK } from "./mark.js";
232
232
  export { detectRunningAgent } from "./agent.js";
233
233
  export default alnair;
package/dist/notify.d.ts CHANGED
@@ -24,6 +24,8 @@ export type MintNotice = {
24
24
  ttl?: string;
25
25
  ms: number;
26
26
  };
27
+ /** One-line grant notice for MCP / agent tool UIs (always plain, includes ▣). */
28
+ export declare function grantNoticeLine(permissions: string[]): string;
27
29
  /** Plain line for agent tool UIs; colored mark only on a real TTY. */
28
30
  export declare function formatMintNotice(n: MintNotice): string;
29
31
  export declare function shouldNotify(explicit?: boolean): boolean;
package/dist/notify.js CHANGED
@@ -92,17 +92,31 @@ export function prettyProvider(provider) {
92
92
  };
93
93
  return known[provider.toLowerCase()] ?? provider;
94
94
  }
95
- function whoFrom(n) {
96
- const groups = [...new Set(n.permissions.map((p) => displayPermission(p).group))];
97
- return groups.length === 1 ? groups[0] : "Access";
95
+ function whoFromPermissions(permissions) {
96
+ const groups = [...new Set(permissions.map((p) => displayPermission(p).group))];
97
+ if (groups.length === 1)
98
+ return groups[0];
99
+ // commit + push in one request — GitHub is the headline grant
100
+ if (groups.includes("GitHub"))
101
+ return "GitHub";
102
+ return "Access";
103
+ }
104
+ function grantMessage(who) {
105
+ return who === "Access" ? "Access granted" : `${who} access granted`;
106
+ }
107
+ /** One-line grant notice for MCP / agent tool UIs (always plain, includes ▣). */
108
+ export function grantNoticeLine(permissions) {
109
+ const who = whoFromPermissions(permissions);
110
+ return `[alnair] ${markGlyph("issued")} ${grantMessage(who)}`;
98
111
  }
99
112
  /** Plain line for agent tool UIs; colored mark only on a real TTY. */
100
113
  export function formatMintNotice(n) {
101
- const who = whoFrom(n);
114
+ const who = whoFromPermissions(n.permissions);
115
+ const msg = grantMessage(who);
102
116
  if (process.stdout.isTTY) {
103
- return ` ${mark("issued")} ${who} access granted\n`;
117
+ return ` ${mark("issued")} ${msg}\n`;
104
118
  }
105
- return ` [alnair] ${markGlyph("issued")} ${who} access granted\n`;
119
+ return ` [alnair] ${markGlyph("issued")} ${msg}\n`;
106
120
  }
107
121
  export function shouldNotify(explicit) {
108
122
  if (explicit === true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alnair-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Give AI agents secure, temporary permissions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",