run402-mcp 2.26.0 → 2.28.0

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.
Files changed (43) hide show
  1. package/README.md +2 -1
  2. package/core/dist/allowance.d.ts +0 -20
  3. package/core/dist/allowance.d.ts.map +1 -1
  4. package/core/dist/allowance.js +24 -1
  5. package/core/dist/allowance.js.map +1 -1
  6. package/core/dist/config.d.ts +26 -0
  7. package/core/dist/config.d.ts.map +1 -1
  8. package/core/dist/config.js +75 -3
  9. package/core/dist/config.js.map +1 -1
  10. package/core/dist/profiles.d.ts +60 -0
  11. package/core/dist/profiles.d.ts.map +1 -0
  12. package/core/dist/profiles.js +196 -0
  13. package/core/dist/profiles.js.map +1 -0
  14. package/dist/config.d.ts +2 -1
  15. package/dist/config.d.ts.map +1 -1
  16. package/dist/config.js +2 -1
  17. package/dist/config.js.map +1 -1
  18. package/dist/tools/status.d.ts.map +1 -1
  19. package/dist/tools/status.js +8 -0
  20. package/dist/tools/status.js.map +1 -1
  21. package/package.json +3 -3
  22. package/sdk/core-dist/allowance.d.ts +0 -20
  23. package/sdk/core-dist/allowance.js +24 -1
  24. package/sdk/core-dist/config.d.ts +26 -0
  25. package/sdk/core-dist/config.js +75 -3
  26. package/sdk/core-dist/profiles.d.ts +60 -0
  27. package/sdk/core-dist/profiles.js +196 -0
  28. package/sdk/dist/credentials.d.ts +16 -0
  29. package/sdk/dist/credentials.d.ts.map +1 -1
  30. package/sdk/dist/index.d.ts +24 -0
  31. package/sdk/dist/index.d.ts.map +1 -1
  32. package/sdk/dist/index.js +30 -0
  33. package/sdk/dist/index.js.map +1 -1
  34. package/sdk/dist/namespaces/deploy.js +73 -1
  35. package/sdk/dist/namespaces/deploy.js.map +1 -1
  36. package/sdk/dist/namespaces/wallets.d.ts +35 -0
  37. package/sdk/dist/namespaces/wallets.d.ts.map +1 -0
  38. package/sdk/dist/namespaces/wallets.js +50 -0
  39. package/sdk/dist/namespaces/wallets.js.map +1 -0
  40. package/sdk/dist/node/credentials.d.ts +2 -1
  41. package/sdk/dist/node/credentials.d.ts.map +1 -1
  42. package/sdk/dist/node/credentials.js +11 -1
  43. package/sdk/dist/node/credentials.js.map +1 -1
@@ -6,26 +6,6 @@ export interface AllowanceData {
6
6
  lastFaucet?: string;
7
7
  rail?: "x402" | "mpp";
8
8
  }
9
- /**
10
- * Load the agent allowance from disk.
11
- *
12
- * Returns `null` for the two "no allowance configured" cases:
13
- * - the file does not exist
14
- * - the file exists but is not parseable JSON (preserve existing UX —
15
- * consumers print "no_allowance" and tell the user to run init)
16
- *
17
- * Throws a structured `Error` (GH-194) when the file parses as JSON but the
18
- * shape is wrong (missing/wrong-type/wrong-length fields). Without this guard
19
- * downstream callers crash with raw stack traces:
20
- * - `cli/lib/status.mjs` reaches for `allowance.address.toLowerCase()`
21
- * and crashes with `TypeError: Cannot read properties of undefined`.
22
- * - `core/src/allowance-auth.ts` passes a malformed `privateKey` to
23
- * `@noble/curves` which throws "expected 32 bytes, got N".
24
- *
25
- * The CLI's `cli/lib/config.mjs:readAllowance()` wrapper and the MCP
26
- * `src/tools/{status,init}.ts` callers translate the throw into their own
27
- * structured envelopes (`code: BAD_ALLOWANCE_FILE`).
28
- */
29
9
  export declare function readAllowance(path?: string): AllowanceData | null;
30
10
  export declare function saveAllowance(data: AllowanceData, path?: string): void;
31
11
  //# sourceMappingURL=allowance.d.ts.map
@@ -1,4 +1,4 @@
1
- import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, renameSync } from "node:fs";
1
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, renameSync, statSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
  import { randomBytes } from "node:crypto";
4
4
  import { getAllowancePath } from "./config.js";
@@ -26,10 +26,33 @@ const PRIVATE_KEY_RE = /^0x[a-fA-F0-9]{64}$/;
26
26
  * `src/tools/{status,init}.ts` callers translate the throw into their own
27
27
  * structured envelopes (`code: BAD_ALLOWANCE_FILE`).
28
28
  */
29
+ /**
30
+ * If an allowance file is readable by group or other (any of the low 0o077
31
+ * bits set), tighten it to 0600 and warn once on stderr. This self-heals the
32
+ * historical case where a legacy world-readable `wallet.json` (mode 0644) was
33
+ * migrated to `allowance.json` via a mode-preserving rename, leaving the
34
+ * private key exposed on a shared machine. Best-effort: POSIX-only and silent
35
+ * on platforms without meaningful Unix modes (e.g. Windows).
36
+ */
37
+ function selfHealPermissions(p) {
38
+ if (process.platform === "win32")
39
+ return;
40
+ try {
41
+ const mode = statSync(p).mode & 0o777;
42
+ if ((mode & 0o077) !== 0) {
43
+ chmodSync(p, 0o600);
44
+ process.stderr.write(`warning: tightened permissions on ${p} from ${mode.toString(8)} to 600 (was readable by other users).\n`);
45
+ }
46
+ }
47
+ catch {
48
+ // Best-effort; never block a read on a chmod/stat failure.
49
+ }
50
+ }
29
51
  export function readAllowance(path) {
30
52
  const p = path ?? getAllowancePath();
31
53
  if (!existsSync(p))
32
54
  return null;
55
+ selfHealPermissions(p);
33
56
  let raw;
34
57
  try {
35
58
  raw = readFileSync(p, "utf-8");
@@ -7,6 +7,32 @@ export declare function getApiBase(): string;
7
7
  * should not need this override.
8
8
  */
9
9
  export declare function getDeployApiBase(): string;
10
+ /**
11
+ * The base credential directory — the root under which the `default` wallet
12
+ * lives directly and named wallets live under `profiles/<name>/`. This is the
13
+ * value `RUN402_CONFIG_DIR` overrides; profiles nest *within* it.
14
+ */
15
+ export declare function getConfigBaseDir(): string;
16
+ export declare const DEFAULT_PROFILE = "default";
17
+ export declare function isValidProfileName(name: string): boolean;
18
+ /**
19
+ * The active wallet/profile name from the environment. `RUN402_WALLET` is
20
+ * canonical; `RUN402_PROFILE` is accepted as an alias. Empty/unset → the
21
+ * reserved `default`. The CLI edge resolves the `--wallet` flag and any
22
+ * per-directory `.run402.json` binding into `RUN402_WALLET` *before* dispatch,
23
+ * so core stays env-only and never reads argv or cwd.
24
+ */
25
+ export declare function getActiveProfile(): string;
26
+ /** Directory holding all named wallets: `{base}/profiles`. */
27
+ export declare function getProfilesDir(): string;
28
+ /**
29
+ * The effective config directory for the *active* wallet. The `default` wallet
30
+ * resolves to the base dir (zero migration for existing single-wallet
31
+ * installs); any named wallet resolves to `{base}/profiles/<name>`. Because
32
+ * keystore, allowance, and meta paths all derive from this, switching the
33
+ * profile env var moves the whole wallet bundle atomically — and the SDK/MCP
34
+ * inherit profile selection for free.
35
+ */
10
36
  export declare function getConfigDir(): string;
11
37
  export declare function getKeystorePath(): string;
12
38
  export declare function getAllowancePath(): string;
@@ -1,6 +1,6 @@
1
1
  import { homedir } from "node:os";
2
2
  import { join } from "node:path";
3
- import { existsSync, renameSync, mkdirSync } from "node:fs";
3
+ import { existsSync, renameSync, mkdirSync, chmodSync } from "node:fs";
4
4
  const DEFAULT_API_BASE = "https://api.run402.com";
5
5
  /**
6
6
  * Validate a user-supplied API base URL. Throws a clear error message that
@@ -47,9 +47,71 @@ export function getDeployApiBase() {
47
47
  const validated = validateApiBase("RUN402_DEPLOY_API_BASE", process.env.RUN402_DEPLOY_API_BASE, fallback);
48
48
  return validated ?? fallback;
49
49
  }
50
- export function getConfigDir() {
50
+ /**
51
+ * The base credential directory — the root under which the `default` wallet
52
+ * lives directly and named wallets live under `profiles/<name>/`. This is the
53
+ * value `RUN402_CONFIG_DIR` overrides; profiles nest *within* it.
54
+ */
55
+ export function getConfigBaseDir() {
51
56
  return process.env.RUN402_CONFIG_DIR || join(homedir(), ".config", "run402");
52
57
  }
58
+ export const DEFAULT_PROFILE = "default";
59
+ // Filesystem-safe wallet/profile name. Lowercase only (avoids collisions on
60
+ // case-insensitive filesystems like macOS), starts alphanumeric, then
61
+ // alphanumeric/underscore/hyphen, max 64 chars. The CLI edge enforces this for
62
+ // nice UX; core re-checks it as a defense-in-depth guard so a hostile
63
+ // `RUN402_WALLET`/`RUN402_PROFILE` cannot traverse outside the profiles dir.
64
+ const PROFILE_NAME_RE = /^[a-z0-9][a-z0-9_-]{0,63}$/;
65
+ export function isValidProfileName(name) {
66
+ return PROFILE_NAME_RE.test(name);
67
+ }
68
+ /**
69
+ * Guard against path traversal from the profile env vars. The reserved
70
+ * `default` profile is always allowed (it maps to the base dir). Any other
71
+ * name must pass the filesystem-safe pattern; otherwise we throw rather than
72
+ * silently resolve a surprising path.
73
+ */
74
+ function assertSafeProfileName(name) {
75
+ if (name === DEFAULT_PROFILE)
76
+ return;
77
+ if (!isValidProfileName(name)) {
78
+ throw new Error(`Invalid wallet/profile name ${JSON.stringify(name)}. ` +
79
+ "Names must match /^[a-z0-9][a-z0-9_-]{0,63}$/ (lowercase letters, digits, '_' and '-'). " +
80
+ "Check the RUN402_WALLET / RUN402_PROFILE env var.");
81
+ }
82
+ }
83
+ /**
84
+ * The active wallet/profile name from the environment. `RUN402_WALLET` is
85
+ * canonical; `RUN402_PROFILE` is accepted as an alias. Empty/unset → the
86
+ * reserved `default`. The CLI edge resolves the `--wallet` flag and any
87
+ * per-directory `.run402.json` binding into `RUN402_WALLET` *before* dispatch,
88
+ * so core stays env-only and never reads argv or cwd.
89
+ */
90
+ export function getActiveProfile() {
91
+ const raw = process.env.RUN402_WALLET ?? process.env.RUN402_PROFILE;
92
+ const name = raw == null ? "" : raw.trim();
93
+ if (!name)
94
+ return DEFAULT_PROFILE;
95
+ assertSafeProfileName(name);
96
+ return name;
97
+ }
98
+ /** Directory holding all named wallets: `{base}/profiles`. */
99
+ export function getProfilesDir() {
100
+ return join(getConfigBaseDir(), "profiles");
101
+ }
102
+ /**
103
+ * The effective config directory for the *active* wallet. The `default` wallet
104
+ * resolves to the base dir (zero migration for existing single-wallet
105
+ * installs); any named wallet resolves to `{base}/profiles/<name>`. Because
106
+ * keystore, allowance, and meta paths all derive from this, switching the
107
+ * profile env var moves the whole wallet bundle atomically — and the SDK/MCP
108
+ * inherit profile selection for free.
109
+ */
110
+ export function getConfigDir() {
111
+ const base = getConfigBaseDir();
112
+ const profile = getActiveProfile();
113
+ return profile === DEFAULT_PROFILE ? base : join(base, "profiles", profile);
114
+ }
53
115
  export function getKeystorePath() {
54
116
  return join(getConfigDir(), "projects.json");
55
117
  }
@@ -59,10 +121,20 @@ export function getAllowancePath() {
59
121
  const dir = getConfigDir();
60
122
  const newPath = join(dir, "allowance.json");
61
123
  const oldPath = join(dir, "wallet.json");
62
- // Auto-migrate from wallet.json → allowance.json
124
+ // Auto-migrate from wallet.json → allowance.json. renameSync preserves the
125
+ // source file's mode, so a legacy world-readable wallet.json (mode 0644)
126
+ // would otherwise carry that mode forward and leave the private key
127
+ // world-readable on a shared machine. Tighten to 0600 after the rename.
63
128
  if (!existsSync(newPath) && existsSync(oldPath)) {
64
129
  mkdirSync(dir, { recursive: true });
65
130
  renameSync(oldPath, newPath);
131
+ try {
132
+ chmodSync(newPath, 0o600);
133
+ }
134
+ catch {
135
+ // Best-effort (e.g. Windows / exotic filesystems). Read-time self-heal
136
+ // in readAllowance() is the backstop.
137
+ }
66
138
  }
67
139
  return newPath;
68
140
  }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Named-wallet profile storage.
3
+ *
4
+ * A "wallet" is a whole config directory. The reserved `default` wallet lives
5
+ * at the base config dir (zero migration for existing installs); every named
6
+ * wallet lives under `{base}/profiles/<name>/` with its own `allowance.json`,
7
+ * `projects.json`, and this module's non-secret `meta.json`.
8
+ *
9
+ * Two levels of active state, mirroring the wallet → project model:
10
+ * - base `{base}/config.json` `active_wallet` — which wallet is the default
11
+ * - per-wallet `projects.json` `active_project_id` — which project within it
12
+ *
13
+ * All writes are atomic (temp-file + rename) and owner-only (0600 files,
14
+ * 0700 dirs). `meta.json` holds only public/display data (no private key), so
15
+ * listing and name display never need to load key material.
16
+ */
17
+ export interface BaseConfig {
18
+ active_wallet?: string;
19
+ }
20
+ export interface ProfileMeta {
21
+ name: string;
22
+ address?: string;
23
+ /** Cached server-side display label; null when unknown/unset. */
24
+ label?: string | null;
25
+ rail?: "x402" | "mpp";
26
+ created?: string;
27
+ }
28
+ export declare function readBaseConfig(): BaseConfig;
29
+ export declare function writeBaseConfig(cfg: BaseConfig): void;
30
+ /**
31
+ * The globally-selected default wallet (set via `wallets use`), or the
32
+ * reserved `default` when unset/invalid. This is precedence rung 4 — below the
33
+ * flag, env var, and per-directory binding.
34
+ */
35
+ export declare function getDefaultWallet(): string;
36
+ export declare function setDefaultWallet(name: string): void;
37
+ /** Absolute directory for a wallet. `default` → base dir; named → profiles/<name>. */
38
+ export declare function profileDir(name: string): string;
39
+ /** Create (if needed) a wallet's directory with owner-only (0700) perms. */
40
+ export declare function ensureProfileDir(name: string): string;
41
+ export declare function readMeta(name: string): ProfileMeta | null;
42
+ export declare function writeMeta(name: string, meta: ProfileMeta): void;
43
+ /** True when a wallet's `allowance.json` exists on disk. */
44
+ export declare function profileExists(name: string): boolean;
45
+ /**
46
+ * All wallet names on disk: `default` (only if a root allowance.json exists)
47
+ * plus every valid directory under `profiles/`.
48
+ */
49
+ export declare function listProfileNames(): string[];
50
+ /** Delete a named wallet's directory. Refuses to remove the reserved default. */
51
+ export declare function removeProfile(name: string): void;
52
+ /**
53
+ * Move a wallet to a new name. Renaming `default` migrates the root-level
54
+ * credential files into `profiles/<newName>/` (so a named wallet is always a
55
+ * directory). Does NOT update the `active_wallet` pointer — the caller owns
56
+ * that orchestration. Throws if the destination already exists or the source
57
+ * is missing.
58
+ */
59
+ export declare function renameProfile(oldName: string, newName: string): void;
60
+ //# sourceMappingURL=profiles.d.ts.map
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Named-wallet profile storage.
3
+ *
4
+ * A "wallet" is a whole config directory. The reserved `default` wallet lives
5
+ * at the base config dir (zero migration for existing installs); every named
6
+ * wallet lives under `{base}/profiles/<name>/` with its own `allowance.json`,
7
+ * `projects.json`, and this module's non-secret `meta.json`.
8
+ *
9
+ * Two levels of active state, mirroring the wallet → project model:
10
+ * - base `{base}/config.json` `active_wallet` — which wallet is the default
11
+ * - per-wallet `projects.json` `active_project_id` — which project within it
12
+ *
13
+ * All writes are atomic (temp-file + rename) and owner-only (0600 files,
14
+ * 0700 dirs). `meta.json` holds only public/display data (no private key), so
15
+ * listing and name display never need to load key material.
16
+ */
17
+ import { readFileSync, writeFileSync, mkdirSync, renameSync, chmodSync, existsSync, readdirSync, rmSync, } from "node:fs";
18
+ import { dirname, join } from "node:path";
19
+ import { randomBytes } from "node:crypto";
20
+ import { getConfigBaseDir, getProfilesDir, DEFAULT_PROFILE, isValidProfileName, } from "./config.js";
21
+ function atomicWrite(p, content, mode) {
22
+ const dir = dirname(p);
23
+ mkdirSync(dir, { recursive: true });
24
+ const tmp = join(dir, `.${randomBytes(4).toString("hex")}.tmp`);
25
+ writeFileSync(tmp, content, { mode });
26
+ renameSync(tmp, p);
27
+ try {
28
+ chmodSync(p, mode);
29
+ }
30
+ catch {
31
+ /* best-effort on non-POSIX */
32
+ }
33
+ }
34
+ // --- base config.json (global default wallet pointer) ---
35
+ function baseConfigPath() {
36
+ return join(getConfigBaseDir(), "config.json");
37
+ }
38
+ export function readBaseConfig() {
39
+ try {
40
+ const parsed = JSON.parse(readFileSync(baseConfigPath(), "utf-8"));
41
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
42
+ return parsed;
43
+ }
44
+ }
45
+ catch {
46
+ /* missing / unreadable / malformed → empty */
47
+ }
48
+ return {};
49
+ }
50
+ export function writeBaseConfig(cfg) {
51
+ atomicWrite(baseConfigPath(), JSON.stringify(cfg, null, 2), 0o600);
52
+ }
53
+ /**
54
+ * The globally-selected default wallet (set via `wallets use`), or the
55
+ * reserved `default` when unset/invalid. This is precedence rung 4 — below the
56
+ * flag, env var, and per-directory binding.
57
+ */
58
+ export function getDefaultWallet() {
59
+ const w = readBaseConfig().active_wallet;
60
+ return w && (w === DEFAULT_PROFILE || isValidProfileName(w)) ? w : DEFAULT_PROFILE;
61
+ }
62
+ export function setDefaultWallet(name) {
63
+ const cfg = readBaseConfig();
64
+ cfg.active_wallet = name;
65
+ writeBaseConfig(cfg);
66
+ }
67
+ // --- per-profile directory + meta.json ---
68
+ /** Absolute directory for a wallet. `default` → base dir; named → profiles/<name>. */
69
+ export function profileDir(name) {
70
+ return name === DEFAULT_PROFILE ? getConfigBaseDir() : join(getProfilesDir(), name);
71
+ }
72
+ /** Create (if needed) a wallet's directory with owner-only (0700) perms. */
73
+ export function ensureProfileDir(name) {
74
+ const dir = profileDir(name);
75
+ if (name === DEFAULT_PROFILE) {
76
+ mkdirSync(dir, { recursive: true });
77
+ return dir;
78
+ }
79
+ const profilesRoot = getProfilesDir();
80
+ mkdirSync(profilesRoot, { recursive: true });
81
+ try {
82
+ chmodSync(profilesRoot, 0o700);
83
+ }
84
+ catch {
85
+ /* best-effort */
86
+ }
87
+ mkdirSync(dir, { recursive: true });
88
+ try {
89
+ chmodSync(dir, 0o700);
90
+ }
91
+ catch {
92
+ /* best-effort */
93
+ }
94
+ return dir;
95
+ }
96
+ function metaPath(name) {
97
+ return join(profileDir(name), "meta.json");
98
+ }
99
+ export function readMeta(name) {
100
+ try {
101
+ const parsed = JSON.parse(readFileSync(metaPath(name), "utf-8"));
102
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
103
+ return parsed;
104
+ }
105
+ }
106
+ catch {
107
+ /* missing / unreadable / malformed → null */
108
+ }
109
+ return null;
110
+ }
111
+ export function writeMeta(name, meta) {
112
+ ensureProfileDir(name);
113
+ atomicWrite(metaPath(name), JSON.stringify(meta, null, 2), 0o600);
114
+ }
115
+ // --- enumeration + lifecycle ---
116
+ /** True when a wallet's `allowance.json` exists on disk. */
117
+ export function profileExists(name) {
118
+ return existsSync(join(profileDir(name), "allowance.json"));
119
+ }
120
+ /**
121
+ * All wallet names on disk: `default` (only if a root allowance.json exists)
122
+ * plus every valid directory under `profiles/`.
123
+ */
124
+ export function listProfileNames() {
125
+ const names = [];
126
+ if (existsSync(join(getConfigBaseDir(), "allowance.json"))) {
127
+ names.push(DEFAULT_PROFILE);
128
+ }
129
+ try {
130
+ for (const entry of readdirSync(getProfilesDir(), { withFileTypes: true })) {
131
+ if (entry.isDirectory() && isValidProfileName(entry.name))
132
+ names.push(entry.name);
133
+ }
134
+ }
135
+ catch {
136
+ /* no profiles dir yet */
137
+ }
138
+ return names;
139
+ }
140
+ /** Delete a named wallet's directory. Refuses to remove the reserved default. */
141
+ export function removeProfile(name) {
142
+ if (name === DEFAULT_PROFILE) {
143
+ throw new Error("Refusing to remove the reserved 'default' wallet");
144
+ }
145
+ rmSync(profileDir(name), { recursive: true, force: true });
146
+ }
147
+ /**
148
+ * Move a wallet to a new name. Renaming `default` migrates the root-level
149
+ * credential files into `profiles/<newName>/` (so a named wallet is always a
150
+ * directory). Does NOT update the `active_wallet` pointer — the caller owns
151
+ * that orchestration. Throws if the destination already exists or the source
152
+ * is missing.
153
+ */
154
+ export function renameProfile(oldName, newName) {
155
+ if (!isValidProfileName(newName)) {
156
+ throw new Error(`Invalid wallet name ${JSON.stringify(newName)}.`);
157
+ }
158
+ if (newName === oldName)
159
+ return;
160
+ const dest = join(getProfilesDir(), newName);
161
+ if (existsSync(dest)) {
162
+ throw new Error(`A wallet named '${newName}' already exists.`);
163
+ }
164
+ mkdirSync(getProfilesDir(), { recursive: true });
165
+ try {
166
+ chmodSync(getProfilesDir(), 0o700);
167
+ }
168
+ catch {
169
+ /* best-effort */
170
+ }
171
+ if (oldName === DEFAULT_PROFILE) {
172
+ if (!profileExists(DEFAULT_PROFILE)) {
173
+ throw new Error("No 'default' wallet to rename.");
174
+ }
175
+ mkdirSync(dest, { recursive: true });
176
+ try {
177
+ chmodSync(dest, 0o700);
178
+ }
179
+ catch {
180
+ /* best-effort */
181
+ }
182
+ const base = getConfigBaseDir();
183
+ for (const f of ["allowance.json", "projects.json", "meta.json"]) {
184
+ const src = join(base, f);
185
+ if (existsSync(src))
186
+ renameSync(src, join(dest, f));
187
+ }
188
+ return;
189
+ }
190
+ const src = join(getProfilesDir(), oldName);
191
+ if (!existsSync(src)) {
192
+ throw new Error(`Wallet '${oldName}' not found.`);
193
+ }
194
+ renameSync(src, dest);
195
+ }
196
+ //# sourceMappingURL=profiles.js.map
@@ -32,6 +32,16 @@ export interface AllowanceData {
32
32
  lastFaucet?: string;
33
33
  rail?: "x402" | "mpp";
34
34
  }
35
+ /**
36
+ * The active wallet's display identity. `name` is the local profile/selector
37
+ * name (e.g. "kychon", or "default" for the root wallet); `label` is the
38
+ * server-side display name, cached locally and `null` when unknown or offline.
39
+ */
40
+ export interface WalletIdentity {
41
+ name: string;
42
+ address: string | null;
43
+ label: string | null;
44
+ }
35
45
  export interface CredentialsProvider {
36
46
  /**
37
47
  * Return per-request auth headers for the given API path, or null if none
@@ -66,5 +76,11 @@ export interface CredentialsProvider {
66
76
  createAllowance?(): Promise<AllowanceData>;
67
77
  /** Return the absolute path to the local allowance file, for diagnostic output. Optional. */
68
78
  getAllowancePath?(): string;
79
+ /**
80
+ * Return the active wallet's display identity (local name + address + cached
81
+ * server label). The Node provider derives this from the active profile;
82
+ * sandbox/session providers may omit it. Used by {@link Run402.whoami}.
83
+ */
84
+ getWalletIdentity?(): Promise<WalletIdentity | null>;
69
85
  }
70
86
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CA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,CAAC,CAAC;IAEvE,oEAAoE;IACpE,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1C,kEAAkE;IAClE,gBAAgB,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C,oEAAoE;IACpE,gBAAgB,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE5C,gFAAgF;IAChF,aAAa,CAAC,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAEhD,6CAA6C;IAC7C,aAAa,CAAC,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD,oHAAoH;IACpH,eAAe,CAAC,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IAE3C,6FAA6F;IAC7F,gBAAgB,CAAC,IAAI,MAAM,CAAC;IAE5B;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACtD"}
@@ -21,6 +21,7 @@ import { Ai } from "./namespaces/ai.js";
21
21
  import { Auth } from "./namespaces/auth.js";
22
22
  import { SenderDomain } from "./namespaces/sender-domain.js";
23
23
  import { Billing } from "./namespaces/billing.js";
24
+ import { Wallets } from "./namespaces/wallets.js";
24
25
  import { Apps } from "./namespaces/apps.js";
25
26
  import { Email } from "./namespaces/email.js";
26
27
  import { Contracts } from "./namespaces/contracts.js";
@@ -60,6 +61,7 @@ export declare class Run402 {
60
61
  readonly auth: Auth;
61
62
  readonly senderDomain: SenderDomain;
62
63
  readonly billing: Billing;
64
+ readonly wallets: Wallets;
63
65
  readonly apps: Apps;
64
66
  readonly email: Email;
65
67
  readonly contracts: Contracts;
@@ -106,6 +108,28 @@ export declare class Run402 {
106
108
  * use {@link project} instead.
107
109
  */
108
110
  useProject(id: string): Promise<ScopedRun402>;
111
+ /**
112
+ * Identify the active wallet and project: `{ name, address, label,
113
+ * activeProject }`. `name` is the local wallet/profile selector (e.g.
114
+ * "kychon", or "default"); `label` is the server-side display name (null
115
+ * when unknown/offline); `address` is the wallet address; `activeProject` is
116
+ * the currently-selected project id (null if none).
117
+ *
118
+ * Degrades gracefully: providers that don't implement `getWalletIdentity`
119
+ * (sandbox/session) still get `address` from `readAllowance` when available.
120
+ */
121
+ whoami(): Promise<WhoAmI>;
122
+ }
123
+ /** Result of {@link Run402.whoami}. */
124
+ export interface WhoAmI {
125
+ /** Local wallet/profile selector name (e.g. "kychon", "default"), or null. */
126
+ name: string | null;
127
+ /** Wallet address, or null when no allowance is configured. */
128
+ address: string | null;
129
+ /** Server-side display label, cached locally; null when unknown/offline. */
130
+ label: string | null;
131
+ /** Active project id, or null when none is selected. */
132
+ activeProject: string | null;
109
133
  }
110
134
  /**
111
135
  * Build a `FileSet` from a path-keyed record of byte sources. A passthrough
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAA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C,OAAO,EACL,EAAE,EACF,WAAW,EACX,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,2BAA2B,EAC3B,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,2BAA2B,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,0BAA0B,CAAC;AAC9C,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,iCAAiC,CAAC;AACrD,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,+BAA+B,CAAC;AACnD,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,sBAAsB,CAAC"}
package/sdk/dist/index.js CHANGED
@@ -21,6 +21,7 @@ import { Ai } from "./namespaces/ai.js";
21
21
  import { Auth } from "./namespaces/auth.js";
22
22
  import { SenderDomain } from "./namespaces/sender-domain.js";
23
23
  import { Billing } from "./namespaces/billing.js";
24
+ import { Wallets } from "./namespaces/wallets.js";
24
25
  import { Apps } from "./namespaces/apps.js";
25
26
  import { Email } from "./namespaces/email.js";
26
27
  import { Contracts } from "./namespaces/contracts.js";
@@ -47,6 +48,7 @@ export class Run402 {
47
48
  auth;
48
49
  senderDomain;
49
50
  billing;
51
+ wallets;
50
52
  apps;
51
53
  email;
52
54
  contracts;
@@ -102,6 +104,7 @@ export class Run402 {
102
104
  this.auth = new Auth(client);
103
105
  this.senderDomain = new SenderDomain(client);
104
106
  this.billing = new Billing(client);
107
+ this.wallets = new Wallets(client);
105
108
  this.apps = new Apps(client);
106
109
  this.email = new Email(client);
107
110
  this.contracts = new Contracts(client);
@@ -158,6 +161,33 @@ export class Run402 {
158
161
  await this.projects.use(id);
159
162
  return this.project(id);
160
163
  }
164
+ /**
165
+ * Identify the active wallet and project: `{ name, address, label,
166
+ * activeProject }`. `name` is the local wallet/profile selector (e.g.
167
+ * "kychon", or "default"); `label` is the server-side display name (null
168
+ * when unknown/offline); `address` is the wallet address; `activeProject` is
169
+ * the currently-selected project id (null if none).
170
+ *
171
+ * Degrades gracefully: providers that don't implement `getWalletIdentity`
172
+ * (sandbox/session) still get `address` from `readAllowance` when available.
173
+ */
174
+ async whoami() {
175
+ const creds = this.#client.credentials;
176
+ const identity = creds.getWalletIdentity ? await creds.getWalletIdentity.call(creds) : null;
177
+ let address = identity?.address ?? null;
178
+ if (address == null && creds.readAllowance) {
179
+ address = (await creds.readAllowance.call(creds))?.address ?? null;
180
+ }
181
+ const activeProject = creds.getActiveProject
182
+ ? await creds.getActiveProject.call(creds)
183
+ : null;
184
+ return {
185
+ name: identity?.name ?? null,
186
+ address,
187
+ label: identity?.label ?? null,
188
+ activeProject: activeProject ?? null,
189
+ };
190
+ }
161
191
  }
162
192
  /**
163
193
  * Build a `FileSet` from a path-keyed record of byte sources. A passthrough
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings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