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 +1 -1
- package/dist/index.js +1 -1
- package/dist/notify.d.ts +2 -0
- package/dist/notify.js +20 -6
- package/package.json +1 -1
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
|
|
96
|
-
const groups = [...new Set(
|
|
97
|
-
|
|
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 =
|
|
114
|
+
const who = whoFromPermissions(n.permissions);
|
|
115
|
+
const msg = grantMessage(who);
|
|
102
116
|
if (process.stdout.isTTY) {
|
|
103
|
-
return ` ${mark("issued")} ${
|
|
117
|
+
return ` ${mark("issued")} ${msg}\n`;
|
|
104
118
|
}
|
|
105
|
-
return ` [alnair] ${markGlyph("issued")} ${
|
|
119
|
+
return ` [alnair] ${markGlyph("issued")} ${msg}\n`;
|
|
106
120
|
}
|
|
107
121
|
export function shouldNotify(explicit) {
|
|
108
122
|
if (explicit === true)
|