@modelprofile.com/authswitch 8.2.0 → 9.0.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_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/authority-contract.d.ts +18 -1
- package/dist_ts/authority-contract.js +3 -2
- package/dist_ts/authority-paths.d.ts +37 -0
- package/dist_ts/authority-paths.js +46 -0
- package/dist_ts/authority-runtime-contract.d.ts +11 -1
- package/dist_ts/classes.authoritybroker.d.ts +9 -0
- package/dist_ts/classes.authoritybroker.js +70 -10
- package/dist_ts/classes.authorityclient.js +20 -1
- package/dist_ts/classes.authoritydaemon.d.ts +14 -3
- package/dist_ts/classes.authoritydaemon.js +33 -2
- package/dist_ts/classes.authoritydatabase.js +11 -2
- package/dist_ts/classes.authorityimport.d.ts +16 -4
- package/dist_ts/classes.authorityimport.js +74 -23
- package/dist_ts/classes.authoritypreuse.js +8 -3
- package/dist_ts/classes.authorityservice.d.ts +10 -11
- package/dist_ts/classes.authorityservice.js +14 -23
- package/dist_ts/classes.cli.d.ts +10 -2
- package/dist_ts/classes.cli.js +12 -4
- package/dist_ts/classes.codexmanaged.d.ts +8 -0
- package/dist_ts/classes.codexmanaged.js +19 -12
- package/dist_ts/classes.legacyfence.d.ts +53 -0
- package/dist_ts/classes.legacyfence.js +189 -0
- package/dist_ts/classes.operations.d.ts +15 -3
- package/dist_ts/classes.operations.js +22 -4
- package/dist_ts/classes.service.d.ts +21 -2
- package/dist_ts/classes.service.js +35 -8
- package/dist_ts/classes.tui.d.ts +2 -1
- package/dist_ts/classes.tui.js +3 -2
- package/dist_ts/ts_migration/legacysources/authswitchstores.js +5 -2
- package/package.json +7 -7
- package/readme.md +129 -17
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/authority-contract.ts +20 -1
- package/ts/authority-paths.ts +69 -0
- package/ts/authority-runtime-contract.ts +11 -1
- package/ts/classes.authoritybroker.ts +68 -10
- package/ts/classes.authorityclient.ts +16 -0
- package/ts/classes.authoritydaemon.ts +45 -4
- package/ts/classes.authoritydatabase.ts +10 -1
- package/ts/classes.authorityimport.ts +101 -24
- package/ts/classes.authoritypreuse.ts +7 -1
- package/ts/classes.authorityservice.ts +15 -30
- package/ts/classes.cli.ts +14 -3
- package/ts/classes.codexmanaged.ts +18 -7
- package/ts/classes.legacyfence.ts +219 -0
- package/ts/classes.operations.ts +22 -3
- package/ts/classes.service.ts +45 -8
- package/ts/classes.tui.ts +3 -1
- package/ts/ts_migration/legacysources/authswitchstores.ts +4 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@modelprofile.com/authswitch',
|
|
6
|
-
version: '
|
|
6
|
+
version: '9.0.0',
|
|
7
7
|
description: 'Manage Codex, OpenCode and Claude Code accounts with guided switching and live usage status'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSw4QkFBOEI7SUFDcEMsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLDZGQUE2RjtDQUMzRyxDQUFBIn0=
|
|
@@ -8,7 +8,13 @@ export type { IAuthSwitchUsageSnapshot } from './classes.authorityusage.js';
|
|
|
8
8
|
* the owner does instead. Everything else stays a fault whose text the transport replaces, and a caller
|
|
9
9
|
* must never present a fault as if it said what to do next.
|
|
10
10
|
*/
|
|
11
|
-
export type TAuthSwitchRefusalCode = 'authority_closing' | 'not_found' | 'account_changed' | 'account_busy' | 'login_unavailable'
|
|
11
|
+
export type TAuthSwitchRefusalCode = 'authority_closing' | 'not_found' | 'account_changed' | 'account_busy' | 'login_unavailable'
|
|
12
|
+
/** A runtime capability that is missing, wrong or superseded: deliberately one answer, and one repair. */
|
|
13
|
+
| 'binding_unauthorized'
|
|
14
|
+
/** The authority holds this login, so the legacy path that used to move it no longer may. */
|
|
15
|
+
| 'authority_holds_login'
|
|
16
|
+
/** An authority is installed on this host and is not answering, so nothing may assume it holds nothing. */
|
|
17
|
+
| 'authority_unavailable' | 'native_owner_holds_login' | 'claude_home_unregistered' | 'claude_handoff_pending' | 'claude_receipt_missing' | 'import_refusal';
|
|
12
18
|
/** The marker the importer has published since 8.1.0; it keeps its own value on the wire. */
|
|
13
19
|
export declare const authSwitchImportRefusalMarker = "authswitch_import_refusal";
|
|
14
20
|
export declare const authSwitchRefusalReason = "authswitch_refusal";
|
|
@@ -60,6 +66,15 @@ export interface IAuthSwitchAccount {
|
|
|
60
66
|
revision: number;
|
|
61
67
|
statusObservedAt: string;
|
|
62
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Which tool refreshes a natively owned login, named rather than inferred.
|
|
71
|
+
*
|
|
72
|
+
* `owner` says that a native tool holds the login; this says which one, so a consumer presents "Claude Code"
|
|
73
|
+
* or "Codex" without deriving it from `purpose` -- a derivation that would be wrong the moment two purposes
|
|
74
|
+
* share a tool, and that belongs to the side that decides ownership in the first place. It is `null` exactly
|
|
75
|
+
* when no native tool refreshes the login: the authority does, or nothing does.
|
|
76
|
+
*/
|
|
77
|
+
export type TAuthSwitchLoginOwnerTool = 'claude_code' | 'codex' | 'opencode';
|
|
63
78
|
/** One independently owned login. Native ownership does not imply observed health. */
|
|
64
79
|
export interface IAuthSwitchLogin {
|
|
65
80
|
id: string;
|
|
@@ -67,6 +82,8 @@ export interface IAuthSwitchLogin {
|
|
|
67
82
|
providerId: string;
|
|
68
83
|
purpose: TAuthSwitchLoginPurpose;
|
|
69
84
|
owner: 'daemon' | 'claude_native' | 'legacy_native' | 'none';
|
|
85
|
+
/** The native tool that refreshes this login, or null when the authority or nobody does. */
|
|
86
|
+
ownerTool: TAuthSwitchLoginOwnerTool | null;
|
|
70
87
|
health: TAuthSwitchLoginHealth;
|
|
71
88
|
problem: 'none' | 'provider_unavailable' | 'exchange_uncertain' | 'provider_rejected' | 'native_owner';
|
|
72
89
|
grantGeneration: number;
|
|
@@ -3,8 +3,9 @@ export const authSwitchImportRefusalMarker = 'authswitch_import_refusal';
|
|
|
3
3
|
export const authSwitchRefusalReason = 'authswitch_refusal';
|
|
4
4
|
const refusalCodes = new Set([
|
|
5
5
|
'authority_closing', 'not_found', 'account_changed', 'account_busy',
|
|
6
|
-
'login_unavailable', 'native_owner_holds_login', 'claude_home_unregistered',
|
|
6
|
+
'login_unavailable', 'binding_unauthorized', 'native_owner_holds_login', 'claude_home_unregistered',
|
|
7
7
|
'claude_handoff_pending', 'claude_receipt_missing', 'import_refusal',
|
|
8
|
+
'authority_holds_login', 'authority_unavailable',
|
|
8
9
|
]);
|
|
9
10
|
const isRefusalCode = (value) => typeof value === 'string' && refusalCodes.has(value);
|
|
10
11
|
/** The importer keeps the marker it published; every other code shares the authority's own. */
|
|
@@ -52,4 +53,4 @@ export const asAuthSwitchRefusal = (error) => {
|
|
|
52
53
|
return { code, instruction };
|
|
53
54
|
};
|
|
54
55
|
/** Runtime capability is returned only to trusted backend callers; do not expose this response in a browser API. */
|
|
55
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
56
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXR5LWNvbnRyYWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYXV0aG9yaXR5LWNvbnRyYWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZCQSw2RkFBNkY7QUFDN0YsTUFBTSxDQUFDLE1BQU0sNkJBQTZCLEdBQUcsMkJBQTJCLENBQUM7QUFDekUsTU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FQUFFLGdCQUFnQixFQUFFLFdBQVcsRUFBRSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUM7SUFDMUcsQ0FBQztJQUNELElBQUksSUFBSSxDQUFDLE1BQU0sS0FBSyx1QkFBdUIsSUFBSSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUM7UUFBRSxPQUFPLElBQUksQ0FBQztJQUNqRixPQUFPLEVBQUUsSUFBSSxFQUFFLFdBQVcsRUFBRSxDQUFDO0FBQy9CLENBQUMsQ0FBQztBQWdZRixvSEFBb0gifQ==
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where this user's authority lives: its sockets, its store and the service unit that runs it.
|
|
3
|
+
*
|
|
4
|
+
* These rules sit in a leaf module because two sides read them. `AuthSwitchAuthorityService` installs and
|
|
5
|
+
* runs the daemon there, and the legacy fence (`./classes.legacyfence`) asks the same socket and looks for
|
|
6
|
+
* the same unit -- without importing the daemon, whose module graph reaches back to the legacy operations
|
|
7
|
+
* the fence guards.
|
|
8
|
+
*/
|
|
9
|
+
export interface IAuthSwitchAuthorityPaths {
|
|
10
|
+
runtimeDirectory: string;
|
|
11
|
+
dataDirectory: string;
|
|
12
|
+
databaseSocketPath: string;
|
|
13
|
+
authoritySocketPath: string;
|
|
14
|
+
runtimeSocketPath: string;
|
|
15
|
+
runtimeSocketDirectory: string;
|
|
16
|
+
}
|
|
17
|
+
/** The authority's sockets. */
|
|
18
|
+
export type TAuthSwitchAuthoritySocketPaths = Omit<IAuthSwitchAuthorityPaths, 'dataDirectory'>;
|
|
19
|
+
/**
|
|
20
|
+
* The sockets under one runtime directory, derived from it alone.
|
|
21
|
+
*
|
|
22
|
+
* The legacy fence asks the socket a caller states and must not depend on anything this process holds --
|
|
23
|
+
* its home or its `XDG_DATA_HOME`, which only the store's directory needs.
|
|
24
|
+
*/
|
|
25
|
+
export declare const authSwitchAuthoritySocketPaths: (runtimeDirectory: string | undefined) => TAuthSwitchAuthoritySocketPaths;
|
|
26
|
+
/** Canonical per-user paths. An explicit runtime directory is also usable by a trusted container host. */
|
|
27
|
+
export declare const resolveAuthSwitchAuthorityPaths: (runtimeDirectory?: string | undefined) => IAuthSwitchAuthorityPaths;
|
|
28
|
+
/** The user service `authswitch authority service install` writes. */
|
|
29
|
+
export declare const authSwitchAuthorityUnitName = "authswitch-authority.service";
|
|
30
|
+
/**
|
|
31
|
+
* The directory that unit is installed into, from a stated environment and home directory.
|
|
32
|
+
*
|
|
33
|
+
* It is the rule smartdaemon applies to a user unit when it is given no directory --
|
|
34
|
+
* `$XDG_DATA_HOME/systemd/user`, default `~/.local/share/systemd/user` -- stated here so the installer passes
|
|
35
|
+
* it explicitly and the fence derives it from the locations its caller states rather than from this process.
|
|
36
|
+
*/
|
|
37
|
+
export declare const authSwitchAuthorityUnitDirectory: (env: NodeJS.ProcessEnv, homeDirectory: string) => string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
/**
|
|
3
|
+
* The sockets under one runtime directory, derived from it alone.
|
|
4
|
+
*
|
|
5
|
+
* The legacy fence asks the socket a caller states and must not depend on anything this process holds --
|
|
6
|
+
* its home or its `XDG_DATA_HOME`, which only the store's directory needs.
|
|
7
|
+
*/
|
|
8
|
+
export const authSwitchAuthoritySocketPaths = (runtimeDirectory) => {
|
|
9
|
+
if (!runtimeDirectory || !plugins.path.isAbsolute(runtimeDirectory)) {
|
|
10
|
+
throw new Error('A private XDG_RUNTIME_DIR is required for authswitch authority.');
|
|
11
|
+
}
|
|
12
|
+
const socketDirectory = plugins.path.join(runtimeDirectory, 'authswitch');
|
|
13
|
+
const runtimeSocketDirectory = plugins.path.join(socketDirectory, 'runtime');
|
|
14
|
+
return {
|
|
15
|
+
runtimeDirectory,
|
|
16
|
+
databaseSocketPath: plugins.path.join(socketDirectory, 'internal', 'db.sock'),
|
|
17
|
+
authoritySocketPath: plugins.path.join(socketDirectory, 'management', 'authority.sock'),
|
|
18
|
+
runtimeSocketPath: plugins.path.join(runtimeSocketDirectory, 'runtime.sock'),
|
|
19
|
+
runtimeSocketDirectory,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/** Canonical per-user paths. An explicit runtime directory is also usable by a trusted container host. */
|
|
23
|
+
export const resolveAuthSwitchAuthorityPaths = (runtimeDirectory = process.env.XDG_RUNTIME_DIR) => {
|
|
24
|
+
const sockets = authSwitchAuthoritySocketPaths(runtimeDirectory);
|
|
25
|
+
const home = plugins.os.userInfo().homedir;
|
|
26
|
+
const dataHome = process.env.XDG_DATA_HOME || plugins.path.join(home, '.local/share');
|
|
27
|
+
if (!plugins.path.isAbsolute(dataHome))
|
|
28
|
+
throw new Error('XDG_DATA_HOME must be an absolute path.');
|
|
29
|
+
return { ...sockets, dataDirectory: plugins.path.join(dataHome, 'authswitch', 'authority') };
|
|
30
|
+
};
|
|
31
|
+
/** The user service `authswitch authority service install` writes. */
|
|
32
|
+
export const authSwitchAuthorityUnitName = 'authswitch-authority.service';
|
|
33
|
+
/**
|
|
34
|
+
* The directory that unit is installed into, from a stated environment and home directory.
|
|
35
|
+
*
|
|
36
|
+
* It is the rule smartdaemon applies to a user unit when it is given no directory --
|
|
37
|
+
* `$XDG_DATA_HOME/systemd/user`, default `~/.local/share/systemd/user` -- stated here so the installer passes
|
|
38
|
+
* it explicitly and the fence derives it from the locations its caller states rather than from this process.
|
|
39
|
+
*/
|
|
40
|
+
export const authSwitchAuthorityUnitDirectory = (env, homeDirectory) => {
|
|
41
|
+
const dataHome = env.XDG_DATA_HOME || plugins.path.join(homeDirectory, '.local/share');
|
|
42
|
+
if (!plugins.path.isAbsolute(dataHome))
|
|
43
|
+
throw new Error('XDG_DATA_HOME must be an absolute path.');
|
|
44
|
+
return plugins.path.join(dataHome, 'systemd/user');
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXR5LXBhdGhzLmpzIiw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Q0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUM7UUFBRSxNQUFNLElBQUksS0FBSyxDQUFDLHlDQUF5QyxDQUFDLENBQUM7SUFDbkcsT0FBTyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsY0FBYyxDQUFDLENBQUM7QUFDckQsQ0FBQyxDQUFDIn0=
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { ITypedRequest } from '@api.global/typedrequest-interfaces';
|
|
2
2
|
import type { IAuthSwitchBinding } from './authority-contract.js';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Backend-only binding operation, served on the MANAGEMENT socket. Not a misplacement -- the rule.
|
|
5
|
+
*
|
|
6
|
+
* The other two requests in this file are answered on the runtime socket, whose directory a container may
|
|
7
|
+
* be given. This one is not, because it mints the capability those two spend: minting is the act that
|
|
8
|
+
* authorizes a runtime, so it belongs to a caller already trusted with account management. A container
|
|
9
|
+
* holding the runtime directory can therefore use the binding it was handed, and can never create one --
|
|
10
|
+
* not for itself, and not for another account.
|
|
11
|
+
*
|
|
12
|
+
* The capability must never enter a browser-facing response.
|
|
13
|
+
*/
|
|
4
14
|
export interface IReq_AuthSwitchBindAccount extends ITypedRequest {
|
|
5
15
|
method: 'authswitch.authority.bind';
|
|
6
16
|
request: {
|
|
@@ -88,6 +88,15 @@ export declare class AuthSwitchAuthorityBroker {
|
|
|
88
88
|
resolveAccess(bindingId: string, capability: string, minValidityMs: number, rejectedGrantGeneration?: number): Promise<IAuthSwitchResolvedAccess>;
|
|
89
89
|
/** Backend-only access for usage; it never creates or bypasses a runtime binding. */
|
|
90
90
|
resolveUsageAccess(context: IAuthSwitchUsageContext, rejectedGrantGeneration: number | undefined, minValidityMs: number): Promise<IAuthSwitchResolvedAccess>;
|
|
91
|
+
/**
|
|
92
|
+
* The shared managed-access loop, whose refusals are deliberately still unmarked faults.
|
|
93
|
+
*
|
|
94
|
+
* Its two callers repair differently: a runtime holding a binding binds again, while the usage reader has
|
|
95
|
+
* no binding at all and collapses everything into one usage problem. Naming a code here would either say
|
|
96
|
+
* "binding" to a caller that has none, or invent a second meaning for one that does, so the decision waits
|
|
97
|
+
* for the slice that gives the usage answer its own vocabulary. What a bound runtime can act on is decided
|
|
98
|
+
* before this point, in the view `resolveAccess` supplies.
|
|
99
|
+
*/
|
|
91
100
|
private resolveManagedAccess;
|
|
92
101
|
private refreshAccount;
|
|
93
102
|
private performRefresh;
|