@nookplot/mcp 0.4.109 → 0.4.111
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/README.md +293 -293
- package/SKILL.md +145 -145
- package/dist/auth.d.ts +5 -112
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +53 -294
- package/dist/auth.js.map +1 -1
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +1 -5
- package/dist/gateway.js.map +1 -1
- package/dist/index.d.ts +1 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -613
- package/dist/index.js.map +1 -1
- package/dist/server.js +81 -81
- package/dist/setup.js +7 -7
- package/dist/tools/cognitiveWorkspace.d.ts.map +1 -1
- package/dist/tools/cognitiveWorkspace.js +0 -30
- package/dist/tools/cognitiveWorkspace.js.map +1 -1
- package/dist/tools/ecosystem.d.ts.map +1 -1
- package/dist/tools/ecosystem.js +5 -1
- package/dist/tools/ecosystem.js.map +1 -1
- package/dist/tools/forgePresets.d.ts +2 -7
- package/dist/tools/forgePresets.d.ts.map +1 -1
- package/dist/tools/forgePresets.js +3 -133
- package/dist/tools/forgePresets.js.map +1 -1
- package/dist/tools/knowledgeGraph.js +1 -1
- package/dist/tools/knowledgeGraph.js.map +1 -1
- package/dist/tools/memory.d.ts.map +1 -1
- package/dist/tools/memory.js +33 -0
- package/dist/tools/memory.js.map +1 -1
- package/dist/tools/miningPipeline.d.ts +2 -6
- package/dist/tools/miningPipeline.d.ts.map +1 -1
- package/dist/tools/miningPipeline.js +3 -392
- package/dist/tools/miningPipeline.js.map +1 -1
- package/dist/tools/onchain.js +2 -2
- package/dist/tools/onchain.js.map +1 -1
- package/dist/tools/papers.d.ts.map +1 -1
- package/dist/tools/papers.js +0 -16
- package/dist/tools/papers.js.map +1 -1
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +6 -27
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/reasoningWork.js +60 -60
- package/dist/tools/swarms.d.ts.map +1 -1
- package/dist/tools/swarms.js +1 -21
- package/dist/tools/swarms.js.map +1 -1
- package/package.json +1 -1
- package/skills/learn/SKILL.md +70 -70
- package/skills/mine/SKILL.md +85 -85
- package/skills/nookplot/SKILL.md +222 -222
- package/skills/social/SKILL.md +84 -84
- package/dist/profileName.d.ts +0 -65
- package/dist/profileName.d.ts.map +0 -1
- package/dist/profileName.js +0 -114
- package/dist/profileName.js.map +0 -1
- package/dist/syncSessions.d.ts +0 -84
- package/dist/syncSessions.d.ts.map +0 -1
- package/dist/syncSessions.js +0 -260
- package/dist/syncSessions.js.map +0 -1
- package/dist/syncSessionsExtractor.d.ts +0 -123
- package/dist/syncSessionsExtractor.d.ts.map +0 -1
- package/dist/syncSessionsExtractor.js +0 -362
- package/dist/syncSessionsExtractor.js.map +0 -1
- package/dist/syncSessionsState.d.ts +0 -89
- package/dist/syncSessionsState.d.ts.map +0 -1
- package/dist/syncSessionsState.js +0 -145
- package/dist/syncSessionsState.js.map +0 -1
- package/skills/hermes/nookplot/DESCRIPTION.md +0 -59
- package/skills/hermes/nookplot/daemon/SKILL.md +0 -103
- package/skills/hermes/nookplot/learn/SKILL.md +0 -131
- package/skills/hermes/nookplot/mine/SKILL.md +0 -111
- package/skills/hermes/nookplot/social/SKILL.md +0 -104
- package/skills/hermes/nookplot/sync/SKILL.md +0 -110
package/dist/auth.js
CHANGED
|
@@ -1,169 +1,71 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Credential management for the Nookplot MCP server.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
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)
|
|
4
|
+
* Stores credentials in ~/.nookplot/credentials.json (chmod 600).
|
|
19
5
|
*
|
|
20
6
|
* @module auth
|
|
21
7
|
*/
|
|
22
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync
|
|
8
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync } from "node:fs";
|
|
23
9
|
import { join } from "node:path";
|
|
24
10
|
import { homedir } from "node:os";
|
|
11
|
+
const NOOKPLOT_DIR = join(homedir(), ".nookplot");
|
|
12
|
+
const CREDENTIALS_PATH = join(NOOKPLOT_DIR, "credentials.json");
|
|
13
|
+
/** Per-profile credential dir — used when NOOKPLOT_PROFILE env is set. */
|
|
14
|
+
const AGENTS_DIR = join(NOOKPLOT_DIR, "agents");
|
|
25
15
|
/**
|
|
26
|
-
*
|
|
27
|
-
* `rename()`s it over the real path. `rename()` is atomic on POSIX + NTFS,
|
|
28
|
-
* so a concurrent reader can never observe a half-written file. If the
|
|
29
|
-
* process crashes between `writeFileSync` and `renameSync`, the original
|
|
30
|
-
* file (if any) is untouched — user data is never lost to a partial write.
|
|
31
|
-
*
|
|
32
|
-
* The chmod is applied to the tmp file BEFORE the rename so the final
|
|
33
|
-
* path is protected from the first moment it exists. On Windows chmod is
|
|
34
|
-
* a no-op (wrapped in try/catch at the caller).
|
|
16
|
+
* Resolve the credentials file path for the current run.
|
|
35
17
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* `active-profile` (sticky default silently clears). The cost of the
|
|
42
|
-
* tmp+rename pattern is one extra syscall; the cost of losing a user's
|
|
43
|
-
* credentials is catastrophic.
|
|
44
|
-
*/
|
|
45
|
-
function writeFileAtomic(path, content, opts = {}) {
|
|
46
|
-
const tmp = `${path}.tmp`;
|
|
47
|
-
writeFileSync(tmp, content, { encoding: "utf-8", mode: opts.mode ?? 0o600 });
|
|
48
|
-
try {
|
|
49
|
-
if (opts.mode !== undefined)
|
|
50
|
-
chmodSync(tmp, opts.mode);
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
// Windows — chmod is a no-op
|
|
54
|
-
}
|
|
55
|
-
try {
|
|
56
|
-
renameSync(tmp, path);
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
// Rename failed — clean up the tmp file so we don't leave garbage.
|
|
60
|
-
// The original `path` (if any) is untouched; caller will see the
|
|
61
|
-
// write as failed and can retry.
|
|
62
|
-
try {
|
|
63
|
-
unlinkSync(tmp);
|
|
64
|
-
}
|
|
65
|
-
catch { /* best effort */ }
|
|
66
|
-
throw err;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// Resolve paths lazily so tests can mock `homedir()` between imports and
|
|
70
|
-
// assertions. Using constants here would cache the real home dir at
|
|
71
|
-
// module-load time and ignore the mock.
|
|
72
|
-
function nookplotDir() { return join(homedir(), ".nookplot"); }
|
|
73
|
-
function credentialsPath() { return join(nookplotDir(), "credentials.json"); }
|
|
74
|
-
/** Path to a specific profile's metadata file. */
|
|
75
|
-
export function profilePath(profileName) {
|
|
76
|
-
return join(nookplotDir(), "profiles", profileName, "profile.json");
|
|
77
|
-
}
|
|
78
|
-
/** Path to the root profiles dir (where all profiles live). */
|
|
79
|
-
export function profilesDir() {
|
|
80
|
-
return join(nookplotDir(), "profiles");
|
|
81
|
-
}
|
|
82
|
-
/** Path to the sticky-default pointer file (set by `nookplot profile use`). */
|
|
83
|
-
function activeProfilePath() {
|
|
84
|
-
return join(nookplotDir(), "active-profile");
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Read `~/.nookplot/active-profile` and return the profile name it points at,
|
|
88
|
-
* or undefined if unset / unreadable / empty. Used as the lowest-priority
|
|
89
|
-
* fallback in `loadCredentials` so a sticky default set by the CLI applies
|
|
90
|
-
* to MCP sessions spawned outside Hermes.
|
|
18
|
+
* Lookup order:
|
|
19
|
+
* 1. Explicit override via NOOKPLOT_CREDENTIALS_PATH env (escape hatch)
|
|
20
|
+
* 2. Profile-scoped path when NOOKPLOT_PROFILE is set + the file exists
|
|
21
|
+
* (~/.nookplot/agents/<profile>/credentials.json)
|
|
22
|
+
* 3. Global ~/.nookplot/credentials.json
|
|
91
23
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
24
|
+
* The profile-scoped path is what makes a forged child agent (vh1, vh2, …)
|
|
25
|
+
* actually authenticate AS itself with the gateway — so tool calls land
|
|
26
|
+
* under the child's address rather than the parent's. The Forge install
|
|
27
|
+
* flow writes this file when the user provides a child keystore.
|
|
94
28
|
*/
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return undefined;
|
|
29
|
+
function resolveCredentialsPath() {
|
|
30
|
+
const explicit = process.env.NOOKPLOT_CREDENTIALS_PATH;
|
|
31
|
+
if (explicit && existsSync(explicit))
|
|
32
|
+
return explicit;
|
|
33
|
+
const profile = process.env.NOOKPLOT_PROFILE;
|
|
34
|
+
if (profile) {
|
|
35
|
+
const scoped = join(AGENTS_DIR, profile, "credentials.json");
|
|
36
|
+
if (existsSync(scoped))
|
|
37
|
+
return scoped;
|
|
105
38
|
}
|
|
39
|
+
return CREDENTIALS_PATH;
|
|
106
40
|
}
|
|
107
41
|
/**
|
|
108
|
-
* Load credentials
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* 1. `NOOKPLOT_PROFILE` env var → `~/.nookplot/profiles/<name>/profile.json`
|
|
112
|
-
* merged with default `credentials.json`. The profile only has
|
|
113
|
-
* `scopedAgentAddress`; creds come from the shared file.
|
|
114
|
-
* 2. Default `~/.nookplot/credentials.json` (legacy single-agent path)
|
|
115
|
-
*
|
|
116
|
-
* Returns null if no creds file exists at all. Invalid profile name or
|
|
117
|
-
* missing profile.json falls back to the default creds (not an error —
|
|
118
|
-
* lets users run unscoped commands even when a profile env var was
|
|
119
|
-
* left over from another shell).
|
|
42
|
+
* Load credentials from disk. Honors NOOKPLOT_PROFILE for child-agent
|
|
43
|
+
* scoping (see resolveCredentialsPath). Returns null if the file doesn't
|
|
44
|
+
* exist.
|
|
120
45
|
*/
|
|
121
|
-
export function loadCredentials(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// 2. `NOOKPLOT_PROFILE` env var — baked into Hermes config.yaml by the
|
|
125
|
-
// installer, or exported by the CLI's preAction hook when --profile
|
|
126
|
-
// was passed
|
|
127
|
-
// 3. Sticky default from `~/.nookplot/active-profile` — written by
|
|
128
|
-
// `nookplot profile use <name>` and honored here so a user who sets
|
|
129
|
-
// their default gets it everywhere, not just in the CLI `profile`
|
|
130
|
-
// subcommand. Without this fallback the sticky default would be a
|
|
131
|
-
// lie for MCP sessions spawned outside Hermes.
|
|
132
|
-
// 4. undefined — creator-direct (no scope merge)
|
|
133
|
-
const profileName = opts?.profile
|
|
134
|
-
?? process.env.NOOKPLOT_PROFILE
|
|
135
|
-
?? readStickyProfile();
|
|
136
|
-
// Always load base creds (API key, private key) from the default path.
|
|
137
|
-
// Per-profile scope is merged on top.
|
|
138
|
-
const baseCreds = loadCredentialsFromFile(credentialsPath());
|
|
139
|
-
if (!baseCreds)
|
|
140
|
-
return null;
|
|
141
|
-
if (!profileName)
|
|
142
|
-
return baseCreds;
|
|
143
|
-
// Try to read the profile's scope file. If it doesn't exist, fall back
|
|
144
|
-
// to base creds without scoping — users who export NOOKPLOT_PROFILE in
|
|
145
|
-
// their shell shouldn't get errors for other commands.
|
|
146
|
-
const profile = loadProfile(profileName);
|
|
147
|
-
if (!profile)
|
|
148
|
-
return baseCreds;
|
|
149
|
-
return {
|
|
150
|
-
...baseCreds,
|
|
151
|
-
scopedAgentAddress: profile.scopedAgentAddress,
|
|
152
|
-
profileName,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
/** Internal: load + validate a credentials.json at a given path. */
|
|
156
|
-
function loadCredentialsFromFile(path) {
|
|
157
|
-
if (!existsSync(path))
|
|
46
|
+
export function loadCredentials() {
|
|
47
|
+
const path = resolveCredentialsPath();
|
|
48
|
+
if (!existsSync(path)) {
|
|
158
49
|
return null;
|
|
50
|
+
}
|
|
159
51
|
try {
|
|
160
52
|
const raw = readFileSync(path, "utf-8");
|
|
161
53
|
const creds = JSON.parse(raw);
|
|
162
54
|
// Validate required fields
|
|
163
55
|
if (!creds.apiKey || !creds.privateKey || !creds.address || !creds.gatewayUrl) {
|
|
164
|
-
console.error(
|
|
56
|
+
console.error("[nookplot-mcp] Invalid credentials file — missing required fields");
|
|
165
57
|
return null;
|
|
166
58
|
}
|
|
59
|
+
// When loaded via a profile path, surface the profile name so the
|
|
60
|
+
// server can log it ("Connected as <addr> · profile: <name>") and so
|
|
61
|
+
// tools can read ctx.scopedAgentAddress without the env var.
|
|
62
|
+
const profileName = process.env.NOOKPLOT_PROFILE;
|
|
63
|
+
if (profileName && path !== CREDENTIALS_PATH) {
|
|
64
|
+
creds.profileName = profileName;
|
|
65
|
+
// The address from the profile creds IS the scoped address — set
|
|
66
|
+
// it explicitly so downstream tools don't need to guess.
|
|
67
|
+
creds.scopedAgentAddress = creds.address;
|
|
68
|
+
}
|
|
167
69
|
return creds;
|
|
168
70
|
}
|
|
169
71
|
catch (err) {
|
|
@@ -171,164 +73,21 @@ function loadCredentialsFromFile(path) {
|
|
|
171
73
|
return null;
|
|
172
74
|
}
|
|
173
75
|
}
|
|
174
|
-
/**
|
|
175
|
-
* Load a profile's metadata file (`profile.json`). Returns null if the
|
|
176
|
-
* profile doesn't exist or the file is malformed. Profile names must
|
|
177
|
-
* match the Hermes-compatible rule — callers should validate beforehand.
|
|
178
|
-
*/
|
|
179
|
-
export function loadProfile(profileName) {
|
|
180
|
-
const path = profilePath(profileName);
|
|
181
|
-
if (!existsSync(path))
|
|
182
|
-
return null;
|
|
183
|
-
try {
|
|
184
|
-
const raw = readFileSync(path, "utf-8");
|
|
185
|
-
const parsed = JSON.parse(raw);
|
|
186
|
-
if (typeof parsed.scopedAgentAddress !== "string" || parsed.scopedAgentAddress.length === 0) {
|
|
187
|
-
console.error(`[nookplot-mcp] Invalid profile '${profileName}' — missing scopedAgentAddress`);
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
190
|
-
return parsed;
|
|
191
|
-
}
|
|
192
|
-
catch (err) {
|
|
193
|
-
console.error(`[nookplot-mcp] Failed to read profile '${profileName}':`, err instanceof Error ? err.message : err);
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Save (or overwrite) a profile's metadata file. Creates the profile
|
|
199
|
-
* directory if needed with 0o700 permissions (chmod-sensitive systems
|
|
200
|
-
* only — Windows no-ops).
|
|
201
|
-
*
|
|
202
|
-
* Callers:
|
|
203
|
-
* - Installer bash writes this after apply-config
|
|
204
|
-
* - CLI `nookplot profile create` writes this
|
|
205
|
-
* - SDK helpers for programmatic profile setup
|
|
206
|
-
*/
|
|
207
|
-
export function saveProfile(profileName, profile) {
|
|
208
|
-
const dir = join(profilesDir(), profileName);
|
|
209
|
-
if (!existsSync(dir)) {
|
|
210
|
-
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
211
|
-
}
|
|
212
|
-
const path = profilePath(profileName);
|
|
213
|
-
const payload = {
|
|
214
|
-
...profile,
|
|
215
|
-
createdAt: profile.createdAt ?? new Date().toISOString(),
|
|
216
|
-
};
|
|
217
|
-
// Atomic: tmp+rename so a crash can't leave profile.json truncated.
|
|
218
|
-
// A corrupt profile.json would orphan the forged agent's wrapper alias
|
|
219
|
-
// (user types `<slug> chat` and gets creator-direct scope instead of
|
|
220
|
-
// the intended agent). Not data loss per se — but silently wrong.
|
|
221
|
-
writeFileAtomic(path, JSON.stringify(payload, null, 2) + "\n", { mode: 0o600 });
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Safer wrapper around `saveProfile` that detects slug collisions before
|
|
225
|
-
* overwriting. Use this instead of calling `saveProfile` directly from
|
|
226
|
-
* any code path that accepts externally-provided profile names (the
|
|
227
|
-
* installer bash, `write-profile` CLI, SDK consumers, etc.).
|
|
228
|
-
*
|
|
229
|
-
* Why: two forged agents whose display names slugify to the same string
|
|
230
|
-
* (e.g. "Research Scout" and "Research-Scout" both → "research-scout")
|
|
231
|
-
* would otherwise silently overwrite each other's profile.json, pointing
|
|
232
|
-
* the wrapper alias `<slug> chat` at whichever was installed most
|
|
233
|
-
* recently. The user has no signal the first install was orphaned.
|
|
234
|
-
*
|
|
235
|
-
* Passing `force: true` makes the write unconditional — reserve this for
|
|
236
|
-
* cases where the caller has explicitly confirmed intent (e.g. the user
|
|
237
|
-
* typed `write-profile --force`).
|
|
238
|
-
*
|
|
239
|
-
* Idempotent re-installs for the SAME forged agent address always succeed
|
|
240
|
-
* (kind: "updated"). CreatedAt is preserved across same-address rewrites
|
|
241
|
-
* so the audit timeline stays intact.
|
|
242
|
-
*/
|
|
243
|
-
export function safeSaveProfile(profileName, profile, opts = {}) {
|
|
244
|
-
const newAddr = profile.scopedAgentAddress.toLowerCase();
|
|
245
|
-
const existing = loadProfile(profileName);
|
|
246
|
-
if (existing) {
|
|
247
|
-
const existingAddr = existing.scopedAgentAddress.toLowerCase();
|
|
248
|
-
if (existingAddr === newAddr) {
|
|
249
|
-
// Same agent — idempotent rewrite. Preserve original createdAt so
|
|
250
|
-
// re-running the installer doesn't reset the profile's audit clock.
|
|
251
|
-
saveProfile(profileName, {
|
|
252
|
-
...profile,
|
|
253
|
-
scopedAgentAddress: newAddr,
|
|
254
|
-
createdAt: profile.createdAt ?? existing.createdAt,
|
|
255
|
-
});
|
|
256
|
-
return { kind: "updated", profileName, previousCreatedAt: existing.createdAt };
|
|
257
|
-
}
|
|
258
|
-
if (!opts.force) {
|
|
259
|
-
return {
|
|
260
|
-
kind: "collision",
|
|
261
|
-
profileName,
|
|
262
|
-
existingAddress: existingAddr,
|
|
263
|
-
attemptedAddress: newAddr,
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
// Forced overwrite: user explicitly opted in. Don't preserve the
|
|
267
|
-
// previous createdAt — this is a genuinely new mapping.
|
|
268
|
-
}
|
|
269
|
-
saveProfile(profileName, { ...profile, scopedAgentAddress: newAddr });
|
|
270
|
-
return { kind: "created", profileName };
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* List every profile that has a valid profile.json. Used by
|
|
274
|
-
* `nookplot profile list` + any UI that shows the user's forged-agent
|
|
275
|
-
* roster. Returns profile names sorted alphabetically for deterministic
|
|
276
|
-
* output.
|
|
277
|
-
*/
|
|
278
|
-
export function listProfiles() {
|
|
279
|
-
if (!existsSync(profilesDir()))
|
|
280
|
-
return [];
|
|
281
|
-
const out = [];
|
|
282
|
-
try {
|
|
283
|
-
const entries = readdirSync(profilesDir());
|
|
284
|
-
for (const name of entries.sort()) {
|
|
285
|
-
const full = join(profilesDir(), name);
|
|
286
|
-
try {
|
|
287
|
-
if (!statSync(full).isDirectory())
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
catch {
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
const profile = loadProfile(name);
|
|
294
|
-
if (profile)
|
|
295
|
-
out.push({ name, profile });
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
catch {
|
|
299
|
-
// Permissions or missing dir — return empty, don't crash.
|
|
300
|
-
}
|
|
301
|
-
return out;
|
|
302
|
-
}
|
|
303
76
|
/**
|
|
304
77
|
* Save credentials to ~/.nookplot/credentials.json with restrictive permissions.
|
|
305
78
|
*/
|
|
306
79
|
export function saveCredentials(creds) {
|
|
307
80
|
// Ensure directory exists
|
|
308
|
-
if (!existsSync(
|
|
309
|
-
mkdirSync(
|
|
81
|
+
if (!existsSync(NOOKPLOT_DIR)) {
|
|
82
|
+
mkdirSync(NOOKPLOT_DIR, { recursive: true, mode: 0o700 });
|
|
83
|
+
}
|
|
84
|
+
const content = JSON.stringify(creds, null, 2) + "\n";
|
|
85
|
+
writeFileSync(CREDENTIALS_PATH, content, { encoding: "utf-8", mode: 0o600 });
|
|
86
|
+
// Ensure restrictive permissions
|
|
87
|
+
try {
|
|
88
|
+
chmodSync(CREDENTIALS_PATH, 0o600);
|
|
310
89
|
}
|
|
311
|
-
|
|
312
|
-
// in creds that were loaded through a profile (e.g. accidentally round-
|
|
313
|
-
// tripped via loadCredentials({profile})), we'd otherwise pollute
|
|
314
|
-
// credentials.json with `scopedAgentAddress` + `profileName` — fields
|
|
315
|
-
// that are per-session metadata, not identity. This strip keeps the
|
|
316
|
-
// file's shape stable: apiKey + privateKey + address + gatewayUrl +
|
|
317
|
-
// optional displayName, nothing else.
|
|
318
|
-
const stripped = {
|
|
319
|
-
apiKey: creds.apiKey,
|
|
320
|
-
privateKey: creds.privateKey,
|
|
321
|
-
address: creds.address,
|
|
322
|
-
gatewayUrl: creds.gatewayUrl,
|
|
323
|
-
...(creds.displayName ? { displayName: creds.displayName } : {}),
|
|
324
|
-
};
|
|
325
|
-
const content = JSON.stringify(stripped, null, 2) + "\n";
|
|
326
|
-
// Atomic: tmp+rename so a crash during rotate-key or first-time
|
|
327
|
-
// registration can't leave credentials.json truncated. A truncated
|
|
328
|
-
// credentials file would force the user to re-register from scratch
|
|
329
|
-
// — a catastrophic UX event. With tmp+rename the worst case on crash
|
|
330
|
-
// is "the old file is unchanged" which is always recoverable.
|
|
331
|
-
writeFileAtomic(credentialsPath(), content, { mode: 0o600 });
|
|
90
|
+
catch { /* Windows doesn't support chmod */ }
|
|
332
91
|
}
|
|
333
92
|
/**
|
|
334
93
|
* Get the gateway URL from env, credentials, or default.
|
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAqBlC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AAClD,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;AAChE,0EAA0E;AAC1E,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,SAAS,sBAAsB;IAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;IACvD,IAAI,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAEtD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC7C,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;QAC7D,IAAI,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;IACxC,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,I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YAAY,CAAC,CA2F5C;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,CAAC,GAAG,OAAO,EACvD,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,EACnD,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IACR,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAmB5C"}
|
package/dist/gateway.js
CHANGED
|
@@ -97,13 +97,9 @@ export async function gatewayRequest(gatewayUrl, method, path, options) {
|
|
|
97
97
|
}
|
|
98
98
|
if (!response.ok) {
|
|
99
99
|
const errBody = data;
|
|
100
|
-
const
|
|
100
|
+
const errorMsg = errBody.message
|
|
101
101
|
? (errBody.error ? `${errBody.error}: ${errBody.message}` : errBody.message)
|
|
102
102
|
: (errBody.error ?? `Request failed (${response.status})`);
|
|
103
|
-
// Prepend machine-readable code so agents can branch on it programmatically
|
|
104
|
-
// (e.g. distinguish SAME_CREATOR_VERIFICATION from POSTER_VERIFICATION
|
|
105
|
-
// even when both surface as 403). Format: `[CODE] human message`.
|
|
106
|
-
const errorMsg = errBody.code ? `[${errBody.code}] ${baseMsg}` : baseMsg;
|
|
107
103
|
return { ok: false, status: response.status, error: errorMsg };
|
|
108
104
|
}
|
|
109
105
|
return { ok: true, status: response.status, data: data };
|
package/dist/gateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,MAAM,UAAU,cAAc,CAAC,MAAyD;IACtF,IAAI,CAAC,MAAM;QAAE,OAA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AE,OAAO,IAAI,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;QAC/D,UAAU,GAAG,MAAM,cAAc,CAAI,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAExE,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC7D,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,IAAI,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;YACjC,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACrE,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;YAC3F,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;YACnD,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,OAAO,UAAW,CAAC;AACrB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,16 +10,5 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @module index
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
|
-
* Compare two semver strings. Returns:
|
|
15
|
-
* -1 if `a < b`, 0 if equal, 1 if `a > b`.
|
|
16
|
-
* Lightweight parser — handles `x.y.z` and `x.y.z-prerelease.n`. We treat
|
|
17
|
-
* a missing pre-release as "higher" than one that has it (so `0.5.0` >
|
|
18
|
-
* `0.5.0-beta.1`). Good enough for the single use-case here — comparing
|
|
19
|
-
* our own `package.json` version against the npm `@latest` dist-tag.
|
|
20
|
-
*
|
|
21
|
-
* Exported for unit tests — production code uses it only inside
|
|
22
|
-
* checkForUpdate().
|
|
23
|
-
*/
|
|
24
|
-
export declare function compareSemver(a: string, b: string): number;
|
|
13
|
+
export {};
|
|
25
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG"}
|