@nookplot/mcp 0.4.90 → 0.4.92
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/applyConfig.d.ts +73 -0
- package/dist/applyConfig.d.ts.map +1 -0
- package/dist/applyConfig.js +418 -0
- package/dist/applyConfig.js.map +1 -0
- package/dist/auth.d.ts +123 -4
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +326 -19
- package/dist/auth.js.map +1 -1
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +5 -1
- package/dist/gateway.js.map +1 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +580 -18
- package/dist/index.js.map +1 -1
- package/dist/profileName.d.ts +65 -0
- package/dist/profileName.d.ts.map +1 -0
- package/dist/profileName.js +114 -0
- package/dist/profileName.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +46 -4
- package/dist/server.js.map +1 -1
- package/dist/setup.d.ts +28 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +204 -6
- package/dist/setup.js.map +1 -1
- package/dist/syncSessions.d.ts +84 -0
- package/dist/syncSessions.d.ts.map +1 -0
- package/dist/syncSessions.js +260 -0
- package/dist/syncSessions.js.map +1 -0
- package/dist/syncSessionsExtractor.d.ts +123 -0
- package/dist/syncSessionsExtractor.d.ts.map +1 -0
- package/dist/syncSessionsExtractor.js +362 -0
- package/dist/syncSessionsExtractor.js.map +1 -0
- package/dist/syncSessionsState.d.ts +89 -0
- package/dist/syncSessionsState.d.ts.map +1 -0
- package/dist/syncSessionsState.js +145 -0
- package/dist/syncSessionsState.js.map +1 -0
- package/dist/tools/captures.d.ts +35 -0
- package/dist/tools/captures.d.ts.map +1 -0
- package/dist/tools/captures.js +315 -0
- package/dist/tools/captures.js.map +1 -0
- package/dist/tools/forgePresets.d.ts +7 -2
- package/dist/tools/forgePresets.d.ts.map +1 -1
- package/dist/tools/forgePresets.js +130 -3
- package/dist/tools/forgePresets.js.map +1 -1
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/knowledgeGraph.d.ts.map +1 -1
- package/dist/tools/knowledgeGraph.js +8 -2
- package/dist/tools/knowledgeGraph.js.map +1 -1
- package/dist/tools/memory.d.ts.map +1 -1
- package/dist/tools/memory.js +0 -33
- package/dist/tools/memory.js.map +1 -1
- package/dist/tools/miningPipeline.d.ts +6 -2
- package/dist/tools/miningPipeline.d.ts.map +1 -1
- package/dist/tools/miningPipeline.js +392 -3
- package/dist/tools/miningPipeline.js.map +1 -1
- package/dist/tools/onchain.d.ts.map +1 -1
- package/dist/tools/onchain.js +11 -0
- package/dist/tools/onchain.js.map +1 -1
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +27 -18
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/reasoningWork.d.ts.map +1 -1
- package/dist/tools/reasoningWork.js +81 -3
- package/dist/tools/reasoningWork.js.map +1 -1
- package/dist/tools/swarms.d.ts.map +1 -1
- package/dist/tools/swarms.js +21 -1
- package/dist/tools/swarms.js.map +1 -1
- package/dist/tools/write.js +4 -4
- package/dist/tools/write.js.map +1 -1
- package/package.json +1 -1
- package/skills/hermes/nookplot/DESCRIPTION.md +59 -0
- package/skills/hermes/nookplot/daemon/SKILL.md +103 -0
- package/skills/hermes/nookplot/learn/SKILL.md +131 -0
- package/skills/hermes/nookplot/mine/SKILL.md +111 -0
- package/skills/hermes/nookplot/social/SKILL.md +104 -0
- package/skills/hermes/nookplot/sync/SKILL.md +110 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `nookplot-mcp apply-config` — redeem + decrypt + apply a Nookplot config
|
|
3
|
+
* bundle to the user's local Hermes installation.
|
|
4
|
+
*
|
|
5
|
+
* This is the final mile of the one-stop-shop installer flow:
|
|
6
|
+
*
|
|
7
|
+
* 1. User configured BYOK / model / messaging on the Nookplot web UI.
|
|
8
|
+
* 2. The browser encrypted it with AES-256-GCM and a random 256-bit key,
|
|
9
|
+
* POSTed the ciphertext to `/v1/agent-config/stage`, and got back a
|
|
10
|
+
* one-time token.
|
|
11
|
+
* 3. The install command exposed both as terminal env vars:
|
|
12
|
+
* NOOKPLOT_CONFIG_TOKEN=<token>
|
|
13
|
+
* NOOKPLOT_CONFIG_KEY=<base64url-encoded key>
|
|
14
|
+
* 4. The installer bash script calls this command with those values.
|
|
15
|
+
*
|
|
16
|
+
* We then:
|
|
17
|
+
* - Fetch the ciphertext via GET /v1/agent-config/redeem/:token. The
|
|
18
|
+
* gateway deletes the row as it returns the payload, so replays fail.
|
|
19
|
+
* - Decrypt locally using the key (which never left the terminal).
|
|
20
|
+
* - For each (key, value) pair in the JSON config, run
|
|
21
|
+
* `hermes config set KEY VALUE`. Hermes auto-routes secrets (API keys,
|
|
22
|
+
* bot tokens) to ~/.hermes/.env and other settings to ~/.hermes/config.yaml.
|
|
23
|
+
*
|
|
24
|
+
* @module applyConfig
|
|
25
|
+
*/
|
|
26
|
+
export interface ApplyConfigOptions {
|
|
27
|
+
/** Opaque token returned by /stage. 64 hex chars. */
|
|
28
|
+
token: string;
|
|
29
|
+
/** base64url-encoded AES-256 key. 43 chars (32 bytes, no padding). */
|
|
30
|
+
key: string;
|
|
31
|
+
/** Gateway base URL. Defaults to the public gateway. */
|
|
32
|
+
gatewayUrl?: string;
|
|
33
|
+
/** Max time per HTTP request in ms. */
|
|
34
|
+
timeoutMs?: number;
|
|
35
|
+
/** Override for the Hermes CLI binary. Defaults to `hermes` on PATH. */
|
|
36
|
+
hermesBin?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Target a specific Hermes profile instead of the default. When set,
|
|
39
|
+
* every `hermes config set ...` becomes `hermes --profile <name>
|
|
40
|
+
* config set ...`, so the BYOK keys + model + messaging tokens land
|
|
41
|
+
* in `~/.hermes/profiles/<name>/config.yaml` (isolated from other
|
|
42
|
+
* forged agents).
|
|
43
|
+
*/
|
|
44
|
+
profile?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Dependency-injection seams for tests — real callers never pass these.
|
|
47
|
+
* Production code uses global fetch + child_process.execFileSync +
|
|
48
|
+
* filesystem reads from ~/.nookplot/credentials.json.
|
|
49
|
+
*/
|
|
50
|
+
_fetch?: typeof fetch;
|
|
51
|
+
_exec?: (bin: string, args: string[]) => void;
|
|
52
|
+
_credentialsReader?: () => {
|
|
53
|
+
apiKey: string;
|
|
54
|
+
} | null;
|
|
55
|
+
}
|
|
56
|
+
export interface ApplyConfigResult {
|
|
57
|
+
/** How many hermes-config-set invocations succeeded. */
|
|
58
|
+
applied: number;
|
|
59
|
+
/** Keys that could not be applied (with the reason why). */
|
|
60
|
+
failures: Array<{
|
|
61
|
+
key: string;
|
|
62
|
+
error: string;
|
|
63
|
+
}>;
|
|
64
|
+
/** The address the bundle was scoped to (comes from the stage payload). */
|
|
65
|
+
agentAddress: string;
|
|
66
|
+
}
|
|
67
|
+
export declare function isAllowedGatewayBase(candidate: string, installerGatewayUrl: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Main orchestration: fetch → decrypt → apply. Returns a result with per-key
|
|
70
|
+
* success/failure so the caller can surface what happened to the user.
|
|
71
|
+
*/
|
|
72
|
+
export declare function applyConfig(opts: ApplyConfigOptions): Promise<ApplyConfigResult>;
|
|
73
|
+
//# sourceMappingURL=applyConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyConfig.d.ts","sourceRoot":"","sources":["../src/applyConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAYH,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,KAAK,CAAC;IACtB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC9C,kBAAkB,CAAC,EAAE,MAAM;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACtD;AAED,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,QAAQ,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,2EAA2E;IAC3E,YAAY,EAAE,MAAM,CAAC;CACtB;AAgRD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAe5F;AAuGD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,iBAAiB,CAAC,CA4D5B"}
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `nookplot-mcp apply-config` — redeem + decrypt + apply a Nookplot config
|
|
3
|
+
* bundle to the user's local Hermes installation.
|
|
4
|
+
*
|
|
5
|
+
* This is the final mile of the one-stop-shop installer flow:
|
|
6
|
+
*
|
|
7
|
+
* 1. User configured BYOK / model / messaging on the Nookplot web UI.
|
|
8
|
+
* 2. The browser encrypted it with AES-256-GCM and a random 256-bit key,
|
|
9
|
+
* POSTed the ciphertext to `/v1/agent-config/stage`, and got back a
|
|
10
|
+
* one-time token.
|
|
11
|
+
* 3. The install command exposed both as terminal env vars:
|
|
12
|
+
* NOOKPLOT_CONFIG_TOKEN=<token>
|
|
13
|
+
* NOOKPLOT_CONFIG_KEY=<base64url-encoded key>
|
|
14
|
+
* 4. The installer bash script calls this command with those values.
|
|
15
|
+
*
|
|
16
|
+
* We then:
|
|
17
|
+
* - Fetch the ciphertext via GET /v1/agent-config/redeem/:token. The
|
|
18
|
+
* gateway deletes the row as it returns the payload, so replays fail.
|
|
19
|
+
* - Decrypt locally using the key (which never left the terminal).
|
|
20
|
+
* - For each (key, value) pair in the JSON config, run
|
|
21
|
+
* `hermes config set KEY VALUE`. Hermes auto-routes secrets (API keys,
|
|
22
|
+
* bot tokens) to ~/.hermes/.env and other settings to ~/.hermes/config.yaml.
|
|
23
|
+
*
|
|
24
|
+
* @module applyConfig
|
|
25
|
+
*/
|
|
26
|
+
import { createDecipheriv } from "node:crypto";
|
|
27
|
+
import { execFileSync } from "node:child_process";
|
|
28
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
29
|
+
import { homedir } from "node:os";
|
|
30
|
+
import { join } from "node:path";
|
|
31
|
+
/**
|
|
32
|
+
* Decode a base64url string (`-` `_`, no padding) to a Buffer.
|
|
33
|
+
* Web Crypto emits base64url by default, so our browser-side encryption
|
|
34
|
+
* produces keys in this form.
|
|
35
|
+
*/
|
|
36
|
+
function fromBase64Url(value) {
|
|
37
|
+
// Convert base64url → base64 by replacing URL-safe chars and
|
|
38
|
+
// re-padding to a multiple of 4.
|
|
39
|
+
let b64 = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
40
|
+
const pad = b64.length % 4;
|
|
41
|
+
if (pad)
|
|
42
|
+
b64 += "=".repeat(4 - pad);
|
|
43
|
+
return Buffer.from(b64, "base64");
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Redeem the ciphertext from the gateway. The endpoint deletes the row as
|
|
47
|
+
* it returns the payload, so replays will 404.
|
|
48
|
+
*/
|
|
49
|
+
async function redeemCiphertext(gatewayUrl, token, fetchFn, timeoutMs) {
|
|
50
|
+
const url = `${gatewayUrl.replace(/\/$/, "")}/v1/agent-config/redeem/${encodeURIComponent(token)}`;
|
|
51
|
+
// AbortController gives us a hard ceiling on wait time so a hung
|
|
52
|
+
// gateway can't freeze the installer.
|
|
53
|
+
const controller = new AbortController();
|
|
54
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
55
|
+
try {
|
|
56
|
+
const res = await fetchFn(url, { signal: controller.signal });
|
|
57
|
+
if (!res.ok) {
|
|
58
|
+
const body = await res.text().catch(() => "");
|
|
59
|
+
if (res.status === 404) {
|
|
60
|
+
throw new Error("Config token not found, already used, or expired. " +
|
|
61
|
+
"Regenerate the install command on your agent's Nookplot page.");
|
|
62
|
+
}
|
|
63
|
+
throw new Error(`Gateway returned ${res.status}: ${body.slice(0, 200)}`);
|
|
64
|
+
}
|
|
65
|
+
const payload = (await res.json());
|
|
66
|
+
if (typeof payload.ciphertext !== "string" ||
|
|
67
|
+
typeof payload.iv !== "string" ||
|
|
68
|
+
typeof payload.authTag !== "string" ||
|
|
69
|
+
typeof payload.agentAddress !== "string") {
|
|
70
|
+
throw new Error("Gateway returned an unexpected payload shape.");
|
|
71
|
+
}
|
|
72
|
+
return payload;
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
clearTimeout(timer);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Decrypt an AES-256-GCM ciphertext. Throws on auth-tag mismatch (i.e.
|
|
80
|
+
* wrong key or tampered ciphertext).
|
|
81
|
+
*/
|
|
82
|
+
function decryptBundle(stage, key) {
|
|
83
|
+
if (key.length !== 32) {
|
|
84
|
+
throw new Error(`AES-256 key must be 32 bytes (got ${key.length}). ` +
|
|
85
|
+
`Check NOOKPLOT_CONFIG_KEY is the full base64url value.`);
|
|
86
|
+
}
|
|
87
|
+
const iv = Buffer.from(stage.iv, "base64");
|
|
88
|
+
const authTag = Buffer.from(stage.authTag, "base64");
|
|
89
|
+
const ciphertext = Buffer.from(stage.ciphertext, "base64");
|
|
90
|
+
if (iv.length !== 12) {
|
|
91
|
+
throw new Error(`Invalid IV length (${iv.length}) — expected 12 bytes.`);
|
|
92
|
+
}
|
|
93
|
+
if (authTag.length !== 16) {
|
|
94
|
+
throw new Error(`Invalid auth tag length (${authTag.length}) — expected 16 bytes.`);
|
|
95
|
+
}
|
|
96
|
+
const decipher = createDecipheriv("aes-256-gcm", key, iv);
|
|
97
|
+
decipher.setAuthTag(authTag);
|
|
98
|
+
let plaintext;
|
|
99
|
+
try {
|
|
100
|
+
plaintext = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
// Auth-tag failure → either wrong key or tampered bytes. In practice
|
|
104
|
+
// the first is common (user pasted the wrong install command), the
|
|
105
|
+
// second means someone was intercepting — either way, bail loud.
|
|
106
|
+
throw new Error("Decryption failed — auth tag mismatch. " +
|
|
107
|
+
"This usually means NOOKPLOT_CONFIG_KEY doesn't match the token " +
|
|
108
|
+
"(regenerate the install command on your agent page).");
|
|
109
|
+
}
|
|
110
|
+
let parsed;
|
|
111
|
+
try {
|
|
112
|
+
parsed = JSON.parse(plaintext.toString("utf8"));
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
throw new Error("Decrypted payload was not valid JSON.");
|
|
116
|
+
}
|
|
117
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
118
|
+
throw new Error("Decrypted payload was not a JSON object.");
|
|
119
|
+
}
|
|
120
|
+
return parsed;
|
|
121
|
+
}
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
// Apply to Hermes
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
/**
|
|
126
|
+
* Valid Hermes config key shape.
|
|
127
|
+
*
|
|
128
|
+
* Hermes accepts:
|
|
129
|
+
* - Dotted lowercase keys (e.g. `model.default`, `terminal.backend`)
|
|
130
|
+
* - SCREAMING_SNAKE_CASE (auto-routed to ~/.hermes/.env, for API keys)
|
|
131
|
+
* - Simple `a-z0-9_` keys for top-level settings
|
|
132
|
+
*
|
|
133
|
+
* We gate strictly here because we're about to exec a subprocess: anything
|
|
134
|
+
* that smells like a shell metachar gets dropped with a recorded failure
|
|
135
|
+
* rather than quietly becoming an argv surprise.
|
|
136
|
+
*/
|
|
137
|
+
function isValidHermesKey(key) {
|
|
138
|
+
return /^[A-Za-z][A-Za-z0-9_.]{0,127}$/.test(key);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Run `hermes config set <key> <value>` for each entry in the config.
|
|
142
|
+
*
|
|
143
|
+
* We skip — and record — anything whose value isn't serializable as a flat
|
|
144
|
+
* string, as well as anything whose key fails our whitelist. The Hermes
|
|
145
|
+
* CLI itself does the routing between config.yaml (plain settings) and
|
|
146
|
+
* .env (API keys), so we don't have to duplicate that logic here.
|
|
147
|
+
*/
|
|
148
|
+
function applyToHermes(config, hermesBin, execFn, profile) {
|
|
149
|
+
let applied = 0;
|
|
150
|
+
const failures = [];
|
|
151
|
+
// When a profile is set, every `hermes config set` call is prefixed
|
|
152
|
+
// with `--profile <name>` so the writes land in
|
|
153
|
+
// ~/.hermes/profiles/<name>/config.yaml rather than the default
|
|
154
|
+
// ~/.hermes/config.yaml. This is how multi-agent installs stay
|
|
155
|
+
// isolated: Agent A's BYOK keys don't clobber Agent B's.
|
|
156
|
+
const profilePrefix = profile ? ["--profile", profile] : [];
|
|
157
|
+
for (const [key, rawValue] of Object.entries(config)) {
|
|
158
|
+
if (!isValidHermesKey(key)) {
|
|
159
|
+
failures.push({ key, error: "Invalid key format (must match /^[A-Za-z][A-Za-z0-9_.]*$/)" });
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
// Flatten to string. Booleans/numbers become their textual form;
|
|
163
|
+
// nested objects are rejected — Hermes uses dotted keys for nesting.
|
|
164
|
+
let value;
|
|
165
|
+
if (typeof rawValue === "string") {
|
|
166
|
+
value = rawValue;
|
|
167
|
+
}
|
|
168
|
+
else if (typeof rawValue === "number" || typeof rawValue === "boolean") {
|
|
169
|
+
value = String(rawValue);
|
|
170
|
+
}
|
|
171
|
+
else if (rawValue === null || rawValue === undefined) {
|
|
172
|
+
failures.push({ key, error: "Value is null or undefined" });
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
failures.push({
|
|
177
|
+
key,
|
|
178
|
+
error: "Value must be a string, number, or boolean (use dotted keys for nesting)",
|
|
179
|
+
});
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
// We pass each arg as a separate argv element — no shell involved,
|
|
184
|
+
// so there's no shell-injection surface even if `value` contains
|
|
185
|
+
// funky characters. (Which it will, for API keys.)
|
|
186
|
+
execFn(hermesBin, [...profilePrefix, "config", "set", key, value]);
|
|
187
|
+
applied += 1;
|
|
188
|
+
}
|
|
189
|
+
catch (err) {
|
|
190
|
+
failures.push({
|
|
191
|
+
key,
|
|
192
|
+
error: err instanceof Error ? err.message : String(err),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return { applied, failures };
|
|
197
|
+
}
|
|
198
|
+
// ---------------------------------------------------------------------------
|
|
199
|
+
// Entry point
|
|
200
|
+
// ---------------------------------------------------------------------------
|
|
201
|
+
// ---------------------------------------------------------------------------
|
|
202
|
+
// Platform-mode expansion
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
/**
|
|
205
|
+
* Expand a "platform" mode bundle into concrete Hermes inference config.
|
|
206
|
+
*
|
|
207
|
+
* When the user picked "Fast & cheap" or "Smart max-effort" on Forge, the
|
|
208
|
+
* bundle from the web UI doesn't carry a real API key — those presets use
|
|
209
|
+
* Nookplot's gateway proxy (OpenAI-compat at /v1/openai/v1/chat/completions),
|
|
210
|
+
* which charges the user's NOOK balance. The bundle instead carries SENTINEL
|
|
211
|
+
* keys that signal "expand me locally":
|
|
212
|
+
*
|
|
213
|
+
* __nookplot_inference_mode = "platform"
|
|
214
|
+
* __nookplot_platform_model = "hermes-3-llama-3.1-8b" (or whichever model)
|
|
215
|
+
* __nookplot_gateway_base = "https://gateway.nookplot.com" (optional)
|
|
216
|
+
*
|
|
217
|
+
* This function:
|
|
218
|
+
* 1. Detects the platform-mode marker.
|
|
219
|
+
* 2. Reads the user's Nookplot API key from local ~/.nookplot/credentials.json.
|
|
220
|
+
* The API key NEVER touches the bundle (so it never lands on the gateway
|
|
221
|
+
* staging table or in transit). The web-staged bundle only has the
|
|
222
|
+
* metadata above; expansion happens at install time on the user's machine.
|
|
223
|
+
* 3. Returns a NEW config object with sentinels stripped + gateway-proxy
|
|
224
|
+
* Hermes config keys added (model.base_url, OPENAI_API_KEY, model.default).
|
|
225
|
+
*
|
|
226
|
+
* Returns the original config unchanged when no platform marker is present —
|
|
227
|
+
* BYOK + messaging-only bundles continue to work exactly as before.
|
|
228
|
+
*
|
|
229
|
+
* Why the indirection vs. just including the API key in the bundle:
|
|
230
|
+
* - Bundle ciphertext lands on the gateway briefly (15-minute TTL). Even
|
|
231
|
+
* though it's encrypted client-side, fewer copies of the user's API key
|
|
232
|
+
* in transit = less attack surface.
|
|
233
|
+
* - Bundle is one-time-use; a user re-installing on a new machine would
|
|
234
|
+
* need a new bundle. Reading from local creds avoids that round-trip.
|
|
235
|
+
* - Future per-agent scoped tokens slot in here without changing the
|
|
236
|
+
* bundle protocol.
|
|
237
|
+
*/
|
|
238
|
+
/**
|
|
239
|
+
* Whitelist of trusted gateway origins for the `__nookplot_gateway_base`
|
|
240
|
+
* override. This guards against bundle-tamper key exfiltration.
|
|
241
|
+
*
|
|
242
|
+
* The installer's own `gatewayUrl` argument is always trusted (it was
|
|
243
|
+
* baked into the install script by the gateway that served it), so we
|
|
244
|
+
* also accept any URL whose origin matches `gatewayUrl`'s origin —
|
|
245
|
+
* that covers staging environments transparently.
|
|
246
|
+
*/
|
|
247
|
+
const TRUSTED_GATEWAY_ORIGINS = new Set([
|
|
248
|
+
"https://gateway.nookplot.com",
|
|
249
|
+
"https://gateway-dev.nookplot.com",
|
|
250
|
+
"http://localhost:8080",
|
|
251
|
+
"http://localhost:3000",
|
|
252
|
+
"http://127.0.0.1:8080",
|
|
253
|
+
"http://127.0.0.1:3000",
|
|
254
|
+
]);
|
|
255
|
+
export function isAllowedGatewayBase(candidate, installerGatewayUrl) {
|
|
256
|
+
let candidateOrigin;
|
|
257
|
+
try {
|
|
258
|
+
candidateOrigin = new URL(candidate).origin;
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
return false; // malformed URL
|
|
262
|
+
}
|
|
263
|
+
if (TRUSTED_GATEWAY_ORIGINS.has(candidateOrigin))
|
|
264
|
+
return true;
|
|
265
|
+
// Also accept anything matching the installer's own gateway origin.
|
|
266
|
+
try {
|
|
267
|
+
if (new URL(installerGatewayUrl).origin === candidateOrigin)
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
/* fall through */
|
|
272
|
+
}
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
function expandPlatformInference(config, gatewayUrl, credentialsReader) {
|
|
276
|
+
const mode = config["__nookplot_inference_mode"];
|
|
277
|
+
if (mode !== "platform") {
|
|
278
|
+
// Fast path: nothing to expand. Strip any rogue __nookplot_* keys
|
|
279
|
+
// anyway so they never reach the Hermes key-validity check.
|
|
280
|
+
const stripped = {};
|
|
281
|
+
for (const [k, v] of Object.entries(config)) {
|
|
282
|
+
if (!k.startsWith("__nookplot_"))
|
|
283
|
+
stripped[k] = v;
|
|
284
|
+
}
|
|
285
|
+
return stripped;
|
|
286
|
+
}
|
|
287
|
+
const model = typeof config["__nookplot_platform_model"] === "string"
|
|
288
|
+
? config["__nookplot_platform_model"]
|
|
289
|
+
: null;
|
|
290
|
+
// The bundle MAY override the gateway base for staging / dev contexts, but
|
|
291
|
+
// we whitelist the host because this URL becomes `model.base_url` in Hermes
|
|
292
|
+
// — which means the user's freshly-written `OPENAI_API_KEY` (read from
|
|
293
|
+
// local credentials) will be sent there on every inference. A bundle that
|
|
294
|
+
// smuggles `__nookplot_gateway_base: "https://evil.example/..."` would
|
|
295
|
+
// exfiltrate the user's API key on first call.
|
|
296
|
+
//
|
|
297
|
+
// Trust set: production gateway, dev gateway, localhost (development),
|
|
298
|
+
// plus whatever was passed as `gatewayUrl` (the installer's argument —
|
|
299
|
+
// already validated upstream). Anything else is silently ignored, falling
|
|
300
|
+
// back to `gatewayUrl`.
|
|
301
|
+
const rawBaseOverride = typeof config["__nookplot_gateway_base"] === "string"
|
|
302
|
+
? config["__nookplot_gateway_base"]
|
|
303
|
+
: null;
|
|
304
|
+
const baseOverride = rawBaseOverride && isAllowedGatewayBase(rawBaseOverride, gatewayUrl)
|
|
305
|
+
? rawBaseOverride
|
|
306
|
+
: null;
|
|
307
|
+
if (rawBaseOverride && !baseOverride) {
|
|
308
|
+
console.error(`[nookplot-mcp] Ignoring untrusted __nookplot_gateway_base override (${rawBaseOverride}). Using ${gatewayUrl} instead. ` +
|
|
309
|
+
`This protects your API key from being sent to an attacker-controlled gateway.`);
|
|
310
|
+
}
|
|
311
|
+
// Read local API key. If not found, abort the expansion — the user needs
|
|
312
|
+
// to register first via `nookplot register` or by deploying their first
|
|
313
|
+
// agent through the web flow.
|
|
314
|
+
const creds = credentialsReader();
|
|
315
|
+
if (!creds || !creds.apiKey) {
|
|
316
|
+
throw new Error("Platform inference mode requires a registered Nookplot account, " +
|
|
317
|
+
"but no credentials were found at ~/.nookplot/credentials.json. " +
|
|
318
|
+
"Run `nookplot register` first, or deploy your first agent on nookplot.com.");
|
|
319
|
+
}
|
|
320
|
+
// Build the expanded config. Strip ALL __nookplot_* sentinels so the
|
|
321
|
+
// downstream Hermes-key validator never sees them.
|
|
322
|
+
const expanded = {};
|
|
323
|
+
for (const [k, v] of Object.entries(config)) {
|
|
324
|
+
if (!k.startsWith("__nookplot_"))
|
|
325
|
+
expanded[k] = v;
|
|
326
|
+
}
|
|
327
|
+
// Trailing-slash-safe base URL. Hermes will append /chat/completions to
|
|
328
|
+
// model.base_url, so we end at /v1/openai/v1 (path includes the inner /v1
|
|
329
|
+
// because OpenAI-compat clients expect it — see openaiAdapter.ts mounting).
|
|
330
|
+
const base = (baseOverride ?? gatewayUrl).replace(/\/+$/, "");
|
|
331
|
+
expanded["model.base_url"] = `${base}/v1/openai/v1`;
|
|
332
|
+
// Use OPENAI_API_KEY because the gateway adapter speaks OpenAI's protocol;
|
|
333
|
+
// Hermes routes auth via the OpenAI provider config when model.base_url
|
|
334
|
+
// is set. Hermes auto-routes SCREAMING_SNAKE_CASE keys to ~/.hermes/.env
|
|
335
|
+
// (or the per-profile .env).
|
|
336
|
+
expanded["OPENAI_API_KEY"] = creds.apiKey;
|
|
337
|
+
// Default model — only set if the bundle specified one. (Forge always
|
|
338
|
+
// does, but we don't blow up if it's missing.)
|
|
339
|
+
if (model && !expanded["model.default"]) {
|
|
340
|
+
expanded["model.default"] = model;
|
|
341
|
+
}
|
|
342
|
+
return expanded;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Default credentials reader — reads ~/.nookplot/credentials.json and returns
|
|
346
|
+
* { apiKey } or null. Isolated from applyConfig main logic so tests can
|
|
347
|
+
* inject a stub without filesystem access.
|
|
348
|
+
*/
|
|
349
|
+
function defaultCredentialsReader() {
|
|
350
|
+
try {
|
|
351
|
+
const credsPath = join(homedir(), ".nookplot", "credentials.json");
|
|
352
|
+
if (!existsSync(credsPath))
|
|
353
|
+
return null;
|
|
354
|
+
const raw = readFileSync(credsPath, "utf-8");
|
|
355
|
+
const parsed = JSON.parse(raw);
|
|
356
|
+
if (typeof parsed.apiKey !== "string" || !parsed.apiKey)
|
|
357
|
+
return null;
|
|
358
|
+
return { apiKey: parsed.apiKey };
|
|
359
|
+
}
|
|
360
|
+
catch {
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Main orchestration: fetch → decrypt → apply. Returns a result with per-key
|
|
366
|
+
* success/failure so the caller can surface what happened to the user.
|
|
367
|
+
*/
|
|
368
|
+
export async function applyConfig(opts) {
|
|
369
|
+
if (!opts.token || !/^[a-f0-9]{64}$/i.test(opts.token)) {
|
|
370
|
+
throw new Error("Invalid NOOKPLOT_CONFIG_TOKEN (must be 64 hex chars). " +
|
|
371
|
+
"Regenerate the install command on your agent's Nookplot page.");
|
|
372
|
+
}
|
|
373
|
+
if (!opts.key) {
|
|
374
|
+
throw new Error("Missing NOOKPLOT_CONFIG_KEY env var.");
|
|
375
|
+
}
|
|
376
|
+
const gatewayUrl = opts.gatewayUrl ?? "https://gateway.nookplot.com";
|
|
377
|
+
const timeoutMs = opts.timeoutMs ?? 15_000;
|
|
378
|
+
const hermesBin = opts.hermesBin ?? "hermes";
|
|
379
|
+
const fetchFn = opts._fetch ?? fetch;
|
|
380
|
+
const execFn = opts._exec ??
|
|
381
|
+
((bin, args) => {
|
|
382
|
+
execFileSync(bin, args, { stdio: "pipe" });
|
|
383
|
+
});
|
|
384
|
+
// Parse the key from base64url.
|
|
385
|
+
let keyBytes;
|
|
386
|
+
try {
|
|
387
|
+
keyBytes = fromBase64Url(opts.key);
|
|
388
|
+
}
|
|
389
|
+
catch (err) {
|
|
390
|
+
throw new Error(`Could not decode NOOKPLOT_CONFIG_KEY as base64url: ${err instanceof Error ? err.message : String(err)}`);
|
|
391
|
+
}
|
|
392
|
+
// 1. Fetch the encrypted bundle (one-time-use token — gateway deletes
|
|
393
|
+
// the row as it responds).
|
|
394
|
+
const stage = await redeemCiphertext(gatewayUrl, opts.token, fetchFn, timeoutMs);
|
|
395
|
+
// 2. Decrypt locally. Auth-tag failures are surfaced as a clear error
|
|
396
|
+
// so the user can regenerate the install command.
|
|
397
|
+
const config = decryptBundle(stage, keyBytes);
|
|
398
|
+
// 2b. Expand platform-mode bundles. For Fast/Smart presets, the bundle
|
|
399
|
+
// contains __nookplot_* sentinel keys that we resolve locally —
|
|
400
|
+
// fetching the user's API key from ~/.nookplot/credentials.json
|
|
401
|
+
// (NEVER from the bundle) and rewriting to concrete model.base_url
|
|
402
|
+
// + OPENAI_API_KEY + model.default config that points Hermes at
|
|
403
|
+
// our gateway's OpenAI-compat adapter.
|
|
404
|
+
//
|
|
405
|
+
// For BYOK + messaging-only bundles this is a no-op (just strips
|
|
406
|
+
// any rogue __nookplot_* keys defensively).
|
|
407
|
+
const credsReader = opts._credentialsReader ?? defaultCredentialsReader;
|
|
408
|
+
const expanded = expandPlatformInference(config, gatewayUrl, credsReader);
|
|
409
|
+
// 3. Apply each entry via `hermes config set`. Hermes routes secrets
|
|
410
|
+
// to .env and other settings to config.yaml.
|
|
411
|
+
const { applied, failures } = applyToHermes(expanded, hermesBin, execFn, opts.profile);
|
|
412
|
+
return {
|
|
413
|
+
applied,
|
|
414
|
+
failures,
|
|
415
|
+
agentAddress: stage.agentAddress,
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
//# sourceMappingURL=applyConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyConfig.js","sourceRoot":"","sources":["../src/applyConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAuDjC;;;;GAIG;AACH,SAAS,aAAa,CAAC,KAAa;IAClC,6DAA6D;IAC7D,iCAAiC;IACjC,IAAI,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACt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M,IAAI,KAAK,CACb,sDAAsD,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACzG,CAAC;IACJ,CAAC;IAED,sEAAsE;IACtE,8BAA8B;IAC9B,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAEjF,sEAAsE;IACtE,qDAAqD;IACrD,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAE9C,uEAAuE;IACvE,oEAAoE;IACpE,oEAAoE;IACpE,uEAAuE;IACvE,oEAAoE;IACpE,2CAA2C;IAC3C,EAAE;IACF,qEAAqE;IACrE,gDAAgD;IAChD,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,IAAI,wBAAwB,CAAC;IACxE,MAAM,QAAQ,GAAG,uBAAuB,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IAE1E,qEAAqE;IACrE,gDAAgD;IAChD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAEvF,OAAO;QACL,OAAO;QACP,QAAQ;QACR,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC;AACJ,CAAC"}
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Credential management for the Nookplot MCP server.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Single source of API-key truth lives at `~/.nookplot/credentials.json`
|
|
5
|
+
* (chmod 600) — creator's API key, private key, gateway URL. Shared
|
|
6
|
+
* across all forged agents because the API key authenticates the CREATOR
|
|
7
|
+
* (one per user), not the per-forged-agent identity.
|
|
8
|
+
*
|
|
9
|
+
* Multi-agent scoping lives in per-profile files:
|
|
10
|
+
* `~/.nookplot/profiles/<name>/profile.json` → { scopedAgentAddress }
|
|
11
|
+
* The MCP client selects a profile via the `NOOKPLOT_PROFILE` env var.
|
|
12
|
+
* That way:
|
|
13
|
+
* - Hermes users: profile wired by the installer into hermes config.yaml
|
|
14
|
+
* as `env.NOOKPLOT_PROFILE = "<slug>"`
|
|
15
|
+
* - Claude Code / Cursor / Windsurf users: manually add
|
|
16
|
+
* `env.NOOKPLOT_PROFILE = "<slug>"` to their MCP config
|
|
17
|
+
* - CLI users: `NOOKPLOT_PROFILE=<slug> nookplot <cmd>` or
|
|
18
|
+
* `nookplot --profile <slug> <cmd>` (set via CLI layer)
|
|
5
19
|
*
|
|
6
20
|
* @module auth
|
|
7
21
|
*/
|
|
@@ -11,12 +25,117 @@ export interface NookplotCredentials {
|
|
|
11
25
|
address: string;
|
|
12
26
|
gatewayUrl: string;
|
|
13
27
|
displayName?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Present only when credentials were loaded through a profile.
|
|
30
|
+
* Set from `~/.nookplot/profiles/<name>/profile.json::scopedAgentAddress`.
|
|
31
|
+
* The server context reads this to populate `ctx.scopedAgentAddress`
|
|
32
|
+
* for tools that forward it to the gateway (capture tools, etc.).
|
|
33
|
+
*
|
|
34
|
+
* Overridden by `NOOKPLOT_AGENT_ADDRESS` env var if that's set.
|
|
35
|
+
*/
|
|
36
|
+
scopedAgentAddress?: string;
|
|
37
|
+
/** Name of the profile the creds were loaded through, for logging. */
|
|
38
|
+
profileName?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Per-profile metadata file (just scope, not creds). */
|
|
41
|
+
export interface NookplotProfile {
|
|
42
|
+
scopedAgentAddress: string;
|
|
43
|
+
/** Optional display name of the forged agent, for nicer log output. */
|
|
44
|
+
displayName?: string;
|
|
45
|
+
/** Optional Hermes profile name if this was installed via the Hermes flow. */
|
|
46
|
+
hermesProfile?: string;
|
|
47
|
+
/** When the profile was created (ISO). For `nookplot profile list`. */
|
|
48
|
+
createdAt?: string;
|
|
14
49
|
}
|
|
50
|
+
/** Path to a specific profile's metadata file. */
|
|
51
|
+
export declare function profilePath(profileName: string): string;
|
|
52
|
+
/** Path to the root profiles dir (where all profiles live). */
|
|
53
|
+
export declare function profilesDir(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Load credentials — profile-aware.
|
|
56
|
+
*
|
|
57
|
+
* Resolution order (first match wins):
|
|
58
|
+
* 1. `NOOKPLOT_PROFILE` env var → `~/.nookplot/profiles/<name>/profile.json`
|
|
59
|
+
* merged with default `credentials.json`. The profile only has
|
|
60
|
+
* `scopedAgentAddress`; creds come from the shared file.
|
|
61
|
+
* 2. Default `~/.nookplot/credentials.json` (legacy single-agent path)
|
|
62
|
+
*
|
|
63
|
+
* Returns null if no creds file exists at all. Invalid profile name or
|
|
64
|
+
* missing profile.json falls back to the default creds (not an error —
|
|
65
|
+
* lets users run unscoped commands even when a profile env var was
|
|
66
|
+
* left over from another shell).
|
|
67
|
+
*/
|
|
68
|
+
export declare function loadCredentials(opts?: {
|
|
69
|
+
profile?: string;
|
|
70
|
+
}): NookplotCredentials | null;
|
|
71
|
+
/**
|
|
72
|
+
* Load a profile's metadata file (`profile.json`). Returns null if the
|
|
73
|
+
* profile doesn't exist or the file is malformed. Profile names must
|
|
74
|
+
* match the Hermes-compatible rule — callers should validate beforehand.
|
|
75
|
+
*/
|
|
76
|
+
export declare function loadProfile(profileName: string): NookplotProfile | null;
|
|
77
|
+
/**
|
|
78
|
+
* Save (or overwrite) a profile's metadata file. Creates the profile
|
|
79
|
+
* directory if needed with 0o700 permissions (chmod-sensitive systems
|
|
80
|
+
* only — Windows no-ops).
|
|
81
|
+
*
|
|
82
|
+
* Callers:
|
|
83
|
+
* - Installer bash writes this after apply-config
|
|
84
|
+
* - CLI `nookplot profile create` writes this
|
|
85
|
+
* - SDK helpers for programmatic profile setup
|
|
86
|
+
*/
|
|
87
|
+
export declare function saveProfile(profileName: string, profile: NookplotProfile): void;
|
|
88
|
+
/**
|
|
89
|
+
* Result of a safeSaveProfile call. Three outcomes: a new profile was
|
|
90
|
+
* created, an existing same-address profile was re-written (idempotent),
|
|
91
|
+
* or a collision was detected (different address for same name).
|
|
92
|
+
*/
|
|
93
|
+
export type SafeSaveProfileResult = {
|
|
94
|
+
kind: "created";
|
|
95
|
+
profileName: string;
|
|
96
|
+
} | {
|
|
97
|
+
kind: "updated";
|
|
98
|
+
profileName: string;
|
|
99
|
+
previousCreatedAt?: string;
|
|
100
|
+
} | {
|
|
101
|
+
kind: "collision";
|
|
102
|
+
profileName: string;
|
|
103
|
+
existingAddress: string;
|
|
104
|
+
attemptedAddress: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Safer wrapper around `saveProfile` that detects slug collisions before
|
|
108
|
+
* overwriting. Use this instead of calling `saveProfile` directly from
|
|
109
|
+
* any code path that accepts externally-provided profile names (the
|
|
110
|
+
* installer bash, `write-profile` CLI, SDK consumers, etc.).
|
|
111
|
+
*
|
|
112
|
+
* Why: two forged agents whose display names slugify to the same string
|
|
113
|
+
* (e.g. "Research Scout" and "Research-Scout" both → "research-scout")
|
|
114
|
+
* would otherwise silently overwrite each other's profile.json, pointing
|
|
115
|
+
* the wrapper alias `<slug> chat` at whichever was installed most
|
|
116
|
+
* recently. The user has no signal the first install was orphaned.
|
|
117
|
+
*
|
|
118
|
+
* Passing `force: true` makes the write unconditional — reserve this for
|
|
119
|
+
* cases where the caller has explicitly confirmed intent (e.g. the user
|
|
120
|
+
* typed `write-profile --force`).
|
|
121
|
+
*
|
|
122
|
+
* Idempotent re-installs for the SAME forged agent address always succeed
|
|
123
|
+
* (kind: "updated"). CreatedAt is preserved across same-address rewrites
|
|
124
|
+
* so the audit timeline stays intact.
|
|
125
|
+
*/
|
|
126
|
+
export declare function safeSaveProfile(profileName: string, profile: NookplotProfile, opts?: {
|
|
127
|
+
force?: boolean;
|
|
128
|
+
}): SafeSaveProfileResult;
|
|
15
129
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
130
|
+
* List every profile that has a valid profile.json. Used by
|
|
131
|
+
* `nookplot profile list` + any UI that shows the user's forged-agent
|
|
132
|
+
* roster. Returns profile names sorted alphabetically for deterministic
|
|
133
|
+
* output.
|
|
18
134
|
*/
|
|
19
|
-
export declare function
|
|
135
|
+
export declare function listProfiles(): Array<{
|
|
136
|
+
name: string;
|
|
137
|
+
profile: NookplotProfile;
|
|
138
|
+
}>;
|
|
20
139
|
/**
|
|
21
140
|
* Save credentials to ~/.nookplot/credentials.json with restrictive permissions.
|
|
22
141
|
*/
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAiDH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAQD,kDAAkD;AAClD,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,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