@corenel/tools-node 0.2.2 → 0.3.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.
package/dist/auth.d.ts CHANGED
@@ -8,9 +8,158 @@ export declare function sidecarDir(base?: string): string;
8
8
  /** The ACCOUNT token from the device flow. Top level, and staying there: it is
9
9
  * not the daemon's, and moving it would sign the user out on upgrade. */
10
10
  export declare function authTokenPath(base?: string): string;
11
- export declare function writeAuthToken(token: string): Promise<void>;
12
- export declare function readAuthToken(): Promise<string | null>;
13
- export declare function clearAuthToken(): Promise<void>;
14
- /** The IAuthTokenProvider for node: the stored login token, else CORENEL_TOKEN env. */
15
- export declare function nodeAuthToken(): IAuthTokenProvider;
11
+ /**
12
+ * The directory both credential files live in.
13
+ *
14
+ * STATE-DIR DECISION, made deliberately: the token file stays HOME-scoped by
15
+ * default and does NOT move under a daemon-private directory. @corenel/cli
16
+ * resolves it from homedir() with no notion of a state dir, and `corenel login`
17
+ * writes it there; relocating it would sign every existing user out on upgrade
18
+ * and leave the CLI unable to find the credential it just wrote. What
19
+ * `--state-dir` does instead is redirect the whole state dir, exactly as the
20
+ * sidecar's `authDir` already does — so `<stateDir>/token` and
21
+ * `<stateDir>/auth.json` stay siblings, an isolated state dir stays isolated
22
+ * (nothing reaches back into the real home), and with no `--state-dir` this
23
+ * resolves to the same `~/.corenel/token` the CLI reads. Identical computation
24
+ * to packages/sidecar/src/auth/store.ts `authDir`, and it must stay identical.
25
+ */
26
+ export declare function credentialDir(stateDir?: string): string;
27
+ /** `<credentialDir>/token` — equals authTokenPath() when no state dir is given. */
28
+ export declare function tokenFilePath(stateDir?: string): string;
29
+ /** `<credentialDir>/auth.json` — the sidecar's richer credential record. */
30
+ export declare function credentialFilePath(stateDir?: string): string;
31
+ /** The environment variable that carries a headless credential. */
32
+ export declare const TOKEN_ENV = "CORENEL_TOKEN";
33
+ /** The environment variable that names the API. Same spelling @corenel/cli's
34
+ * `apiBase()` reads, because two names for one decision is how they drift. */
35
+ export declare const API_BASE_ENV = "CORENEL_API_BASE";
36
+ /** The credential file's shape. `expiresAt` absent means the issuer did not say
37
+ * — which is NOT the same as "not expired". */
38
+ export interface StoredCredential {
39
+ accessToken: string;
40
+ refreshToken?: string;
41
+ /** Epoch ms. Absent means the issuer did not say. */
42
+ expiresAt?: number;
43
+ /** For display only — never used for authorization. */
44
+ account?: string;
45
+ /**
46
+ * The API base this credential was MINTED against.
47
+ *
48
+ * A token is only valid at the host that issued it, so the base belongs to
49
+ * the login, not to the machine: a daemon defaulting to a different host
50
+ * spends a token nobody there has heard of, and the failure is a 401 a long
51
+ * way from the sign-in that caused it. Absent on every credential written
52
+ * before this was recorded, which is why every reader falls back to the
53
+ * default rather than treating absence as an error.
54
+ */
55
+ apiBase?: string;
56
+ }
57
+ export declare function writeAuthToken(token: string, stateDir?: string): Promise<void>;
58
+ /**
59
+ * Record a completed sign-in in BOTH stores, including WHERE it was minted.
60
+ *
61
+ * `writeAuthToken` alone leaves the token file holding a bearer token with no
62
+ * record of which API issued it -- which is fine right up until the machine is
63
+ * pointed somewhere else by a default, and then it is a 401 with no visible
64
+ * cause. The base goes in auth.json because the token file is one line by
65
+ * contract and every existing reader of it splits on nothing.
66
+ *
67
+ * The credential record is REPLACED, not merged: a new sign-in may be a
68
+ * different account at a different host, and carrying the previous one's
69
+ * account or base onto it would report something nobody established.
70
+ */
71
+ export declare function writeLoginCredential(token: string, opts?: {
72
+ apiBase?: string;
73
+ stateDir?: string;
74
+ account?: string;
75
+ }): Promise<void>;
76
+ export declare function readAuthToken(stateDir?: string): Promise<string | null>;
77
+ /** Remove the token file only. Prefer clearAllCredentials for anything a user
78
+ * would call signing out — see the warning there. */
79
+ export declare function clearAuthToken(stateDir?: string): Promise<void>;
80
+ /** Read `<dir>/auth.json`, or null when there is none. A malformed file is
81
+ * treated as absent rather than fatal — a corrupt credential should send the
82
+ * user through sign-in, not wedge the daemon. */
83
+ export declare function readCredentialFile(stateDir?: string): Promise<StoredCredential | null>;
84
+ /**
85
+ * Sign out of BOTH stores.
86
+ *
87
+ * Clearing one while the other still authenticates is the same divergence bug
88
+ * pointing the other way, and worse: the operator believes they signed out
89
+ * while the gateway keeps sending a credential. Every sign-out path must land
90
+ * here rather than removing a single file.
91
+ */
92
+ export declare function clearAllCredentials(stateDir?: string): Promise<void>;
93
+ /** Which store answered. */
94
+ export type CredentialSource = 'env' | 'token-file' | 'credential-file' | 'none';
95
+ export interface ResolvedCredential {
96
+ token: string | null;
97
+ source: CredentialSource;
98
+ /** Where it was read from on disk. Absent for 'env' and 'none'. */
99
+ path?: string;
100
+ /** Epoch ms, when a store recorded one. Absent means UNKNOWN, not "fresh". */
101
+ expiresAt?: number;
102
+ /** True only when an expiry is known AND has passed. */
103
+ expired?: boolean;
104
+ /** Display only, never used for authorization. */
105
+ account?: string;
106
+ /** The API this credential was minted against, when the sign-in recorded one.
107
+ * Absent for an older credential — read that as "not recorded", never as
108
+ * "the default". */
109
+ apiBase?: string;
110
+ }
111
+ export interface ResolveCredentialOptions {
112
+ env?: NodeJS.ProcessEnv;
113
+ stateDir?: string;
114
+ now?: () => number;
115
+ }
116
+ /**
117
+ * Resolve the credential this machine authenticates with, per the precedence
118
+ * documented at the top of this file.
119
+ *
120
+ * An expired stored credential is REPORTED, not skipped: the caller decides
121
+ * whether to refresh or re-prompt, and one that ignores `expired` fails at the
122
+ * gateway rather than here. A token file records no expiry at all, so
123
+ * `expiresAt` stays undefined for it unless the credential file beside it
124
+ * describes the same token — the absence of an expiry must never be read as
125
+ * evidence of freshness.
126
+ */
127
+ export declare function resolveNodeCredential(opts?: ResolveCredentialOptions): Promise<ResolvedCredential>;
128
+ /** Which answer resolveApiBase gave. Reported so a startup banner can say why
129
+ * it is talking to the host it is talking to. */
130
+ export type ApiBaseSource = 'explicit' | 'env' | 'credential' | 'default';
131
+ export interface ResolvedApiBase {
132
+ base: string;
133
+ source: ApiBaseSource;
134
+ }
135
+ export interface ResolveApiBaseOptions {
136
+ /** A flag the operator typed (`--endpoint`, `--base`). Empty means absent —
137
+ * that is how a missing flag arrives from every caller here. */
138
+ explicit?: string;
139
+ env?: NodeJS.ProcessEnv;
140
+ stateDir?: string;
141
+ }
142
+ /**
143
+ * Which API to talk to.
144
+ *
145
+ * 1. an explicit flag — the operator is pointing somewhere on purpose
146
+ * 2. CORENEL_API_BASE — a container/CI statement of present intent
147
+ * 3. the credential's base — where the token this machine holds was minted
148
+ * 4. DEFAULT_API_BASE — nothing has been said, so say the product's own
149
+ *
150
+ * (3) is the change worth stating: the sidecar carried a literal default, so a
151
+ * user who signed in against one deployment had their daemon talk to another,
152
+ * and the only symptom was a 401 or a 404 far from the login. Preferring the
153
+ * credential's own base makes the common case need no flag at all, while (1)
154
+ * keeps `--endpoint` meaning exactly what it says for local dev.
155
+ */
156
+ export declare function resolveApiBase(opts?: ResolveApiBaseOptions): Promise<ResolvedApiBase>;
157
+ /** A token is a credential; printing one puts it in scrollback, shell history
158
+ * and any screen share. Four leading characters identify WHICH token this is
159
+ * without being usable if the output is pasted somewhere. */
160
+ export declare function maskToken(token: string): string;
161
+ /** The IAuthTokenProvider for node. Resolves exactly what `auth` reports, which
162
+ * is the whole point: the status command must describe the credential the
163
+ * gateway will actually send. */
164
+ export declare function nodeAuthToken(stateDir?: string): IAuthTokenProvider;
16
165
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../auth.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAW5D;2DAC2D;AAC3D,wBAAgB,UAAU,CAAC,IAAI,GAAE,MAAkB,GAAG,MAAM,CAE3D;AAED;iFACiF;AACjF,wBAAgB,UAAU,CAAC,IAAI,GAAE,MAAkB,GAAG,MAAM,CAE3D;AAED;0EAC0E;AAC1E,wBAAgB,aAAa,CAAC,IAAI,GAAE,MAAkB,GAAG,MAAM,CAE9D;AAED,wB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ACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC,kBAAkB,CAAC,CA0B7B;AAkBD;kDACkD;AAClD,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,KAAK,GAAG,YAAY,GAAG,SAAS,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC;qEACiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,IAAI,GAAE,qBAA0B,GAAG,OAAO,CAAC,eAAe,CAAC,CAW/F;AAED;;8DAE8D;AAC9D,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED;;kCAEkC;AAClC,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAEnE"}
package/dist/auth.js CHANGED
@@ -1,19 +1,60 @@
1
- /* Node auth token store — ~/<state dir>/token (default ~/.corenel/token, owner-only).
2
- * `corenel login` writes it via the device flow; the CLI's token guard + gateway
3
- * client read it through the IAuthTokenProvider port (falling back to the
4
- * CORENEL_TOKEN env). Separate from the sidecar's ~/<state dir>/daemon.token
5
- * (default ~/.corenel/daemon.token — that's the local pairing token). */
1
+ /* Node auth credential store — the ONE place that decides which credential this
2
+ * machine authenticates with.
3
+ *
4
+ * TWO STORES, ONE ANSWER. A sign-in can land in either of two files, written by
5
+ * different halves of the product:
6
+ *
7
+ * <dir>/token a bare bearer token, one line. Written by `corenel login`
8
+ * (@corenel/cli's device flow) and read by the gateway
9
+ * client. This is the file real users are signed in with.
10
+ * <dir>/auth.json the richer record from the sidecar's PKCE flow
11
+ * (packages/sidecar/src/auth/store.ts): accessToken plus
12
+ * refreshToken, expiresAt and account.
13
+ *
14
+ * They used to be resolved independently, so `corenel-sidecar auth` could
15
+ * answer "Not signed in" about auth.json on a machine whose gateway calls were
16
+ * succeeding with the token file. That is the bug this module exists to close:
17
+ * everything that asks "is this machine signed in?" and everything that asks
18
+ * "what do I send?" now goes through resolveNodeCredential below.
19
+ *
20
+ * PRECEDENCE, stated once so nobody has to derive it:
21
+ *
22
+ * 1. CORENEL_TOKEN in the environment.
23
+ * 2. <dir>/token — the token file.
24
+ * 3. <dir>/auth.json — the credential file.
25
+ *
26
+ * (1) is first because the environment is a present-tense statement of intent:
27
+ * it is how a container, a CI job or an SSH session supplies identity, and
28
+ * those are exactly the places where a file on disk may be a stale artifact of
29
+ * an image build. It also means a `logout` cannot silently appear to fail — the
30
+ * commands say so explicitly when the variable is set.
31
+ *
32
+ * (2) beats (3) because the token file is the credential that already works:
33
+ * the gateway client and @corenel/cli have always read it, and real installs
34
+ * are signed in through it right now. Making the newer store win would change
35
+ * which token a working machine sends. The two only ever diverge on a machine
36
+ * that signed in both ways, because saveCredential writes BOTH and
37
+ * clearAllCredentials removes BOTH — so login and logout leave the two readers
38
+ * agreeing rather than leaning on the precedence at all. When the credential
39
+ * file describes the SAME token, its account/expiry metadata is carried over,
40
+ * which is the only reason (3) is consulted after (2) has already answered.
41
+ *
42
+ * Separate from the sidecar's <dir>/sidecar/daemon.token, which is the local
43
+ * PAIRING token: that authenticates a connection to a port, it does not say who
44
+ * the user is, and merging the two would turn "can reach the port" into "is the
45
+ * account owner".
46
+ */
6
47
  import { promises as fs } from 'node:fs';
7
48
  import { homedir } from 'node:os';
8
49
  import { join } from 'node:path';
9
- import { stateDirName } from '@corenel/protocol';
50
+ import { stateDirName, DEFAULT_API_BASE } from '@corenel/protocol';
10
51
  /* Every path helper takes an explicit base, defaulting to the real home.
11
52
  *
12
53
  * Not a convenience. The layout migration built on these MOVES files, and a
13
54
  * helper that can only resolve homedir() would force every test of it to run
14
55
  * against the developer's own ~/.corenel -- the one holding their edited
15
- * personas. Taking a base makes that mistake impossible rather than
16
- * discouraged. */
56
+ * personas, and the token they are signed in with right now. Taking a base
57
+ * makes that mistake impossible rather than discouraged. */
17
58
  /** The state dir: `<home>/.corenel`. ALSO the global crew root -- global agents
18
59
  * resolve as `<stateDir>/crew` -- so this never moves. */
19
60
  export function corenelDir(base = homedir()) {
@@ -29,7 +70,38 @@ export function sidecarDir(base = homedir()) {
29
70
  export function authTokenPath(base = homedir()) {
30
71
  return join(corenelDir(base), 'token');
31
72
  }
32
- export async function writeAuthToken(token) {
73
+ /**
74
+ * The directory both credential files live in.
75
+ *
76
+ * STATE-DIR DECISION, made deliberately: the token file stays HOME-scoped by
77
+ * default and does NOT move under a daemon-private directory. @corenel/cli
78
+ * resolves it from homedir() with no notion of a state dir, and `corenel login`
79
+ * writes it there; relocating it would sign every existing user out on upgrade
80
+ * and leave the CLI unable to find the credential it just wrote. What
81
+ * `--state-dir` does instead is redirect the whole state dir, exactly as the
82
+ * sidecar's `authDir` already does — so `<stateDir>/token` and
83
+ * `<stateDir>/auth.json` stay siblings, an isolated state dir stays isolated
84
+ * (nothing reaches back into the real home), and with no `--state-dir` this
85
+ * resolves to the same `~/.corenel/token` the CLI reads. Identical computation
86
+ * to packages/sidecar/src/auth/store.ts `authDir`, and it must stay identical.
87
+ */
88
+ export function credentialDir(stateDir) {
89
+ return stateDir ?? corenelDir();
90
+ }
91
+ /** `<credentialDir>/token` — equals authTokenPath() when no state dir is given. */
92
+ export function tokenFilePath(stateDir) {
93
+ return join(credentialDir(stateDir), 'token');
94
+ }
95
+ /** `<credentialDir>/auth.json` — the sidecar's richer credential record. */
96
+ export function credentialFilePath(stateDir) {
97
+ return join(credentialDir(stateDir), 'auth.json');
98
+ }
99
+ /** The environment variable that carries a headless credential. */
100
+ export const TOKEN_ENV = 'CORENEL_TOKEN';
101
+ /** The environment variable that names the API. Same spelling @corenel/cli's
102
+ * `apiBase()` reads, because two names for one decision is how they drift. */
103
+ export const API_BASE_ENV = 'CORENEL_API_BASE';
104
+ export async function writeAuthToken(token, stateDir) {
33
105
  /* 0o700 on the DIRECTORY, not just 0o600 on the file. Without a mode, mkdir
34
106
  * lands on the process umask -- typically 0o755, so the directory holding a
35
107
  * bearer token is world-listable. The file's own contents stay protected
@@ -37,36 +109,200 @@ export async function writeAuthToken(token) {
37
109
  * has a Corenel token and when they last refreshed it. `recursive: true`
38
110
  * applies the mode only to directories it actually CREATES, so this never
39
111
  * tightens a pre-existing ~/.corenel a user set up deliberately. */
40
- await fs.mkdir(corenelDir(), { recursive: true, mode: 0o700 });
41
- await fs.writeFile(authTokenPath(), token.trim() + '\n', { mode: 0o600 });
112
+ const dir = credentialDir(stateDir);
113
+ const path = tokenFilePath(stateDir);
114
+ await fs.mkdir(dir, { recursive: true, mode: 0o700 });
115
+ await fs.writeFile(path, token.trim() + '\n', { mode: 0o600 });
42
116
  // Both chmods are best-effort: non-POSIX filesystems reject them, and a
43
117
  // failure here must not lose a token that is already written correctly.
44
118
  try {
45
- await fs.chmod(authTokenPath(), 0o600);
119
+ await fs.chmod(path, 0o600);
46
120
  }
47
121
  catch { /* non-POSIX */ }
48
122
  try {
49
- await fs.chmod(corenelDir(), 0o700);
123
+ await fs.chmod(dir, 0o700);
50
124
  }
51
125
  catch { /* non-POSIX */ }
52
126
  }
53
- export async function readAuthToken() {
127
+ /**
128
+ * Record a completed sign-in in BOTH stores, including WHERE it was minted.
129
+ *
130
+ * `writeAuthToken` alone leaves the token file holding a bearer token with no
131
+ * record of which API issued it -- which is fine right up until the machine is
132
+ * pointed somewhere else by a default, and then it is a 401 with no visible
133
+ * cause. The base goes in auth.json because the token file is one line by
134
+ * contract and every existing reader of it splits on nothing.
135
+ *
136
+ * The credential record is REPLACED, not merged: a new sign-in may be a
137
+ * different account at a different host, and carrying the previous one's
138
+ * account or base onto it would report something nobody established.
139
+ */
140
+ export async function writeLoginCredential(token, opts = {}) {
141
+ const cred = {
142
+ accessToken: token.trim(),
143
+ ...(opts.account ? { account: opts.account } : {}),
144
+ ...(opts.apiBase ? { apiBase: opts.apiBase } : {}),
145
+ };
146
+ const path = credentialFilePath(opts.stateDir);
147
+ await fs.mkdir(credentialDir(opts.stateDir), { recursive: true, mode: 0o700 });
148
+ await fs.writeFile(path, `${JSON.stringify(cred, null, 2)}\n`, { mode: 0o600 });
54
149
  try {
55
- const t = (await fs.readFile(authTokenPath(), 'utf8')).trim();
150
+ await fs.chmod(path, 0o600);
151
+ }
152
+ catch { /* non-POSIX */ }
153
+ await writeAuthToken(cred.accessToken, opts.stateDir);
154
+ }
155
+ export async function readAuthToken(stateDir) {
156
+ try {
157
+ const t = (await fs.readFile(tokenFilePath(stateDir), 'utf8')).trim();
56
158
  return t || null;
57
159
  }
58
160
  catch {
59
161
  return null;
60
162
  }
61
163
  }
62
- export async function clearAuthToken() {
164
+ /** Remove the token file only. Prefer clearAllCredentials for anything a user
165
+ * would call signing out — see the warning there. */
166
+ export async function clearAuthToken(stateDir) {
63
167
  try {
64
- await fs.rm(authTokenPath(), { force: true });
168
+ await fs.rm(tokenFilePath(stateDir), { force: true });
65
169
  }
66
170
  catch { /* already gone */ }
67
171
  }
68
- /** The IAuthTokenProvider for node: the stored login token, else CORENEL_TOKEN env. */
69
- export function nodeAuthToken() {
70
- return { getToken: async () => (await readAuthToken()) ?? process.env.CORENEL_TOKEN ?? null };
172
+ /** Read `<dir>/auth.json`, or null when there is none. A malformed file is
173
+ * treated as absent rather than fatal — a corrupt credential should send the
174
+ * user through sign-in, not wedge the daemon. */
175
+ export async function readCredentialFile(stateDir) {
176
+ let raw;
177
+ try {
178
+ raw = await fs.readFile(credentialFilePath(stateDir), 'utf8');
179
+ }
180
+ catch {
181
+ // ENOENT is the ordinary case. EACCES/EISDIR read the same way here because
182
+ // a caller can do nothing different with them: there is no usable
183
+ // credential either way, and crashing the daemon over it helps nobody.
184
+ return null;
185
+ }
186
+ try {
187
+ const parsed = JSON.parse(raw);
188
+ if (typeof parsed !== 'object' || parsed === null)
189
+ return null;
190
+ const c = parsed;
191
+ if (typeof c.accessToken !== 'string' || !c.accessToken)
192
+ return null;
193
+ return {
194
+ accessToken: c.accessToken,
195
+ ...(typeof c.refreshToken === 'string' ? { refreshToken: c.refreshToken } : {}),
196
+ ...(typeof c.expiresAt === 'number' ? { expiresAt: c.expiresAt } : {}),
197
+ ...(typeof c.account === 'string' ? { account: c.account } : {}),
198
+ ...(typeof c.apiBase === 'string' && c.apiBase ? { apiBase: c.apiBase } : {}),
199
+ };
200
+ }
201
+ catch {
202
+ return null;
203
+ }
204
+ }
205
+ /**
206
+ * Sign out of BOTH stores.
207
+ *
208
+ * Clearing one while the other still authenticates is the same divergence bug
209
+ * pointing the other way, and worse: the operator believes they signed out
210
+ * while the gateway keeps sending a credential. Every sign-out path must land
211
+ * here rather than removing a single file.
212
+ */
213
+ export async function clearAllCredentials(stateDir) {
214
+ await clearAuthToken(stateDir);
215
+ try {
216
+ await fs.rm(credentialFilePath(stateDir), { force: true });
217
+ }
218
+ catch { /* already gone */ }
219
+ }
220
+ /**
221
+ * Resolve the credential this machine authenticates with, per the precedence
222
+ * documented at the top of this file.
223
+ *
224
+ * An expired stored credential is REPORTED, not skipped: the caller decides
225
+ * whether to refresh or re-prompt, and one that ignores `expired` fails at the
226
+ * gateway rather than here. A token file records no expiry at all, so
227
+ * `expiresAt` stays undefined for it unless the credential file beside it
228
+ * describes the same token — the absence of an expiry must never be read as
229
+ * evidence of freshness.
230
+ */
231
+ export async function resolveNodeCredential(opts = {}) {
232
+ const env = opts.env ?? process.env;
233
+ const now = opts.now ?? Date.now;
234
+ const stateDir = opts.stateDir;
235
+ const fromEnv = env[TOKEN_ENV]?.trim();
236
+ if (fromEnv)
237
+ return { token: fromEnv, source: 'env' };
238
+ const cred = await readCredentialFile(stateDir);
239
+ const fileToken = await readAuthToken(stateDir);
240
+ if (fileToken) {
241
+ // Metadata is borrowed ONLY when the credential file describes this same
242
+ // token. Two different tokens mean two different sign-ins, and attaching
243
+ // one's expiry to the other would report a freshness nobody established.
244
+ const same = cred && cred.accessToken === fileToken ? cred : null;
245
+ return withExpiry({ token: fileToken, source: 'token-file', path: tokenFilePath(stateDir) }, same, now);
246
+ }
247
+ if (cred) {
248
+ return withExpiry({ token: cred.accessToken, source: 'credential-file', path: credentialFilePath(stateDir) }, cred, now);
249
+ }
250
+ return { token: null, source: 'none' };
251
+ }
252
+ function withExpiry(base, cred, now) {
253
+ if (!cred)
254
+ return base;
255
+ const expired = typeof cred.expiresAt === 'number' && cred.expiresAt <= now();
256
+ return {
257
+ ...base,
258
+ ...(typeof cred.expiresAt === 'number' ? { expiresAt: cred.expiresAt } : {}),
259
+ ...(expired ? { expired: true } : {}),
260
+ ...(cred.account ? { account: cred.account } : {}),
261
+ ...(cred.apiBase ? { apiBase: cred.apiBase } : {}),
262
+ };
263
+ }
264
+ /**
265
+ * Which API to talk to.
266
+ *
267
+ * 1. an explicit flag — the operator is pointing somewhere on purpose
268
+ * 2. CORENEL_API_BASE — a container/CI statement of present intent
269
+ * 3. the credential's base — where the token this machine holds was minted
270
+ * 4. DEFAULT_API_BASE — nothing has been said, so say the product's own
271
+ *
272
+ * (3) is the change worth stating: the sidecar carried a literal default, so a
273
+ * user who signed in against one deployment had their daemon talk to another,
274
+ * and the only symptom was a 401 or a 404 far from the login. Preferring the
275
+ * credential's own base makes the common case need no flag at all, while (1)
276
+ * keeps `--endpoint` meaning exactly what it says for local dev.
277
+ */
278
+ export async function resolveApiBase(opts = {}) {
279
+ const explicit = opts.explicit?.trim();
280
+ if (explicit)
281
+ return { base: explicit, source: 'explicit' };
282
+ const fromEnv = (opts.env ?? process.env)[API_BASE_ENV]?.trim();
283
+ if (fromEnv)
284
+ return { base: fromEnv, source: 'env' };
285
+ const cred = await resolveNodeCredential({
286
+ env: {},
287
+ ...(opts.stateDir ? { stateDir: opts.stateDir } : {}),
288
+ });
289
+ if (cred.apiBase)
290
+ return { base: cred.apiBase, source: 'credential' };
291
+ return { base: DEFAULT_API_BASE, source: 'default' };
292
+ }
293
+ /** A token is a credential; printing one puts it in scrollback, shell history
294
+ * and any screen share. Four leading characters identify WHICH token this is
295
+ * without being usable if the output is pasted somewhere. */
296
+ export function maskToken(token) {
297
+ const t = token.trim();
298
+ if (t.length <= 8)
299
+ return '****';
300
+ return `${t.slice(0, 4)}…${t.slice(-2)} (${t.length} chars)`;
301
+ }
302
+ /** The IAuthTokenProvider for node. Resolves exactly what `auth` reports, which
303
+ * is the whole point: the status command must describe the credential the
304
+ * gateway will actually send. */
305
+ export function nodeAuthToken(stateDir) {
306
+ return { getToken: async () => (await resolveNodeCredential(stateDir ? { stateDir } : {})).token };
71
307
  }
72
308
  //# sourceMappingURL=auth.js.map
package/dist/auth.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../auth.ts"],"names":[],"mappings":"AAAA;;;;yEAIyE;AACzE,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;kBAMkB;AAElB;2DAC2D;AAC3D,MAAM,UAAU,UAAU,CAAC,OAAe,OAAO,EAAE;IACjD,OAAO,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AACpC,CAAC;AAED;iFACiF;AACjF,MAAM,UAAU,UAAU,CAAC,OAAe,OAAO,EAAE;IACjD,OAAO,IAAI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B"}
@@ -206,8 +206,13 @@ export class NodeFileService {
206
206
  out.push({ name: e.name, path, kind: 'directory', children: await walk(absChild) });
207
207
  }
208
208
  else {
209
+ // The stat is already being paid for `size`; `mtime` rides along for
210
+ // free. It is what lets a caller ORDER files without reading them
211
+ // (the session store pages its newest-first list off this), so the
212
+ // node backend now matches DirectoryHandleFileService, which has
213
+ // always supplied both.
209
214
  const st = await fs.stat(absChild).catch(() => null);
210
- out.push({ name: e.name, path, kind: 'file', size: st?.size, ext: extOf(e.name) });
215
+ out.push({ name: e.name, path, kind: 'file', size: st?.size, mtime: st?.mtimeMs, ext: extOf(e.name) });
211
216
  }
212
217
  }
213
218
  return out;
@@ -220,7 +225,7 @@ export class NodeFileService {
220
225
  async stat(path) {
221
226
  try {
222
227
  const st = await fs.stat(this.abs(path));
223
- return { path: normalizeFilePath(path), kind: st.isDirectory() ? 'directory' : 'file', size: st.size, ext: extOf(path) };
228
+ return { path: normalizeFilePath(path), kind: st.isDirectory() ? 'directory' : 'file', size: st.size, mtime: st.mtimeMs, ext: extOf(path) };
224
229
  }
225
230
  catch {
226
231
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"fileService.js","sourceRoot":"","sources":["../fileService.ts"],"names":[],"mappings":"AAAA;;;;gDAIgD;AAChD,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAExF,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE3E;;;;;;;;;;;;;;;;;sCAiBsC;AACtC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC;IACnB,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ;IACpE,cAAc,EAAE,cAA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BAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAAC,SAAS;YAAC,CAAC;YACrE,IAAI,CAAC;gBAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,uBAAuB,CAAC,CAAC;QACtH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,gEAAgE;IACnF,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { NodeFileService } from './fileService';
2
- export { corenelDir, sidecarDir, authTokenPath, writeAuthToken, readAuthToken, clearAuthToken, nodeAuthToken, } from './auth';
2
+ export { corenelDir, sidecarDir, authTokenPath, credentialDir, tokenFilePath, credentialFilePath, writeAuthToken, readAuthToken, readCredentialFile, clearAuthToken, clearAllCredentials, resolveNodeCredential, nodeAuthToken, maskToken, TOKEN_ENV, writeLoginCredential, resolveApiBase, API_BASE_ENV, type StoredCredential, type CredentialSource, type ResolvedCredential, type ResolveCredentialOptions, type ApiBaseSource, type ResolvedApiBase, type ResolveApiBaseOptions, } from './auth';
3
3
  export { nodePromptHost } from './promptHost';
4
4
  export { migrateHomeLayout, type MigrationReport } from './migrateHome';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,GACpG,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EACvF,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EACtF,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAC1D,oBAAoB,EAAE,cAAc,EAAE,YAAY,EAClD,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,KAAK,wBAAwB,EACpG,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,GACrE,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* @corenel/tools-node — node capabilities (the tools-web twin). */
2
2
  export { NodeFileService } from './fileService';
3
- export { corenelDir, sidecarDir, authTokenPath, writeAuthToken, readAuthToken, clearAuthToken, nodeAuthToken, } from './auth';
3
+ export { corenelDir, sidecarDir, authTokenPath, credentialDir, tokenFilePath, credentialFilePath, writeAuthToken, readAuthToken, readCredentialFile, clearAuthToken, clearAllCredentials, resolveNodeCredential, nodeAuthToken, maskToken, TOKEN_ENV, writeLoginCredential, resolveApiBase, API_BASE_ENV, } from './auth';
4
4
  export { nodePromptHost } from './promptHost';
5
5
  export { migrateHomeLayout } from './migrateHome';
6
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,GACpG,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAwB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EACvF,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EACtF,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAC1D,oBAAoB,EAAE,cAAc,EAAE,YAAY,GAGnD,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAwB,MAAM,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corenel/tools-node",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "description": "Corenel node capabilities — the tools-web twin. A disk-backed FileService (the harness file tools + node PromptHost workspace) over node:fs, confined to a root. Shell/secrets/~/.corenel to follow.",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@prompd/core": "0.5.0-beta.10",
19
- "@corenel/harness": "0.4.1",
20
- "@corenel/protocol": "0.4.1"
19
+ "@corenel/harness": "0.6.0",
20
+ "@corenel/protocol": "0.6.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^24.13.1",
@@ -30,6 +30,11 @@
30
30
  "files": [
31
31
  "dist"
32
32
  ],
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/Prompd/prompd-web.git",
36
+ "directory": "packages/tools-node"
37
+ },
33
38
  "scripts": {
34
39
  "typecheck": "tsc --noEmit",
35
40
  "preverify": "pnpm --filter @corenel/protocol build && pnpm --filter @corenel/harness build",