@sipher.dev/agents 0.1.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/index.d.ts +1 -0
- package/dist/index.js +3498 -0
- package/dist/local-machine-controller-Dtiash-C.js +2129 -0
- package/dist/local-machine.d.ts +177 -0
- package/dist/local-machine.js +2 -0
- package/package.json +47 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
//#region src/tls.d.ts
|
|
2
|
+
interface TlsOptions {
|
|
3
|
+
allowInsecureTls?: boolean | undefined;
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/auth-client.d.ts
|
|
7
|
+
interface DeviceAuthorization {
|
|
8
|
+
deviceCode: string;
|
|
9
|
+
userCode: string;
|
|
10
|
+
verificationUri: string;
|
|
11
|
+
verificationUriComplete: string;
|
|
12
|
+
expiresIn: number;
|
|
13
|
+
interval: number;
|
|
14
|
+
}
|
|
15
|
+
interface TokenResponse {
|
|
16
|
+
accessToken: string;
|
|
17
|
+
refreshToken: string;
|
|
18
|
+
expiresIn: number;
|
|
19
|
+
tokenType: "Bearer";
|
|
20
|
+
}
|
|
21
|
+
declare class CliAuthClient {
|
|
22
|
+
private readonly serverUrl;
|
|
23
|
+
private readonly options;
|
|
24
|
+
constructor(serverUrl: string, options?: TlsOptions);
|
|
25
|
+
startDeviceAuthorization(deviceLabel?: string | undefined): Promise<DeviceAuthorization>;
|
|
26
|
+
pollDeviceToken(deviceCode: string): Promise<TokenResponse>;
|
|
27
|
+
refresh(refreshToken: string): Promise<TokenResponse>;
|
|
28
|
+
revoke(refreshToken: string): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/connector-client.d.ts
|
|
32
|
+
interface AccessTokenProviderOptions {
|
|
33
|
+
forceRefresh?: boolean;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/machine-client.d.ts
|
|
37
|
+
interface ClaimedMachine {
|
|
38
|
+
machineId: string;
|
|
39
|
+
name: string;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/token-store.d.ts
|
|
43
|
+
interface AuthProfile {
|
|
44
|
+
serverUrl: string;
|
|
45
|
+
connectorInstallId: string;
|
|
46
|
+
allowInsecureTls?: boolean;
|
|
47
|
+
refreshToken?: string;
|
|
48
|
+
accessToken?: string;
|
|
49
|
+
accessTokenExpiresAt?: string;
|
|
50
|
+
machineId?: string;
|
|
51
|
+
}
|
|
52
|
+
interface TokenStoreData {
|
|
53
|
+
activeServerUrl?: string;
|
|
54
|
+
profiles: Record<string, AuthProfile>;
|
|
55
|
+
}
|
|
56
|
+
declare class TokenStore {
|
|
57
|
+
private readonly path;
|
|
58
|
+
constructor(path?: string);
|
|
59
|
+
read(): Promise<TokenStoreData>;
|
|
60
|
+
resolveServerUrl(explicitServerUrl?: string | undefined): Promise<string>;
|
|
61
|
+
getProfile(serverUrl: string): Promise<AuthProfile | undefined>;
|
|
62
|
+
saveLogin(input: {
|
|
63
|
+
serverUrl: string;
|
|
64
|
+
refreshToken: string;
|
|
65
|
+
accessToken: string;
|
|
66
|
+
expiresInSeconds: number;
|
|
67
|
+
allowInsecureTls?: boolean | undefined;
|
|
68
|
+
now?: Date | undefined;
|
|
69
|
+
}): Promise<AuthProfile>;
|
|
70
|
+
updateProfile(serverUrl: string, update: (profile: AuthProfile | undefined) => AuthProfile): Promise<AuthProfile>;
|
|
71
|
+
removeProfile(serverUrl: string): Promise<AuthProfile | undefined>;
|
|
72
|
+
withLockedData<T>(callback: (data: TokenStoreData) => Promise<T> | T): Promise<T>;
|
|
73
|
+
private readData;
|
|
74
|
+
private writeData;
|
|
75
|
+
}
|
|
76
|
+
declare function normalizeServerUrl(value: string): string;
|
|
77
|
+
declare function defaultTokenStorePath(): string;
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/local-machine-controller.d.ts
|
|
80
|
+
interface LocalMachineReadyOptions {
|
|
81
|
+
serverUrl: string;
|
|
82
|
+
store: TokenStore;
|
|
83
|
+
name?: string | undefined;
|
|
84
|
+
installService?: boolean | undefined;
|
|
85
|
+
serviceInstaller?: LocalMachineServiceInstaller | undefined;
|
|
86
|
+
allowInsecureTls?: boolean | undefined;
|
|
87
|
+
}
|
|
88
|
+
interface LocalMachineServiceInstallInput {
|
|
89
|
+
serverUrl: string;
|
|
90
|
+
allowInsecureTls?: boolean | undefined;
|
|
91
|
+
}
|
|
92
|
+
type LocalMachineServiceInstaller = (input: LocalMachineServiceInstallInput) => Promise<void>;
|
|
93
|
+
type LocalMachineReadyErrorCode = "refresh_failed" | "claim_conflict" | "claim_failed" | "service_unsupported" | "service_install_failed";
|
|
94
|
+
type LocalMachineReadyResult = {
|
|
95
|
+
state: "ready";
|
|
96
|
+
serverUrl: string;
|
|
97
|
+
machineId: string;
|
|
98
|
+
machineName: string;
|
|
99
|
+
} | {
|
|
100
|
+
state: "needs_login";
|
|
101
|
+
serverUrl: string;
|
|
102
|
+
message: string;
|
|
103
|
+
} | {
|
|
104
|
+
state: "error";
|
|
105
|
+
code: LocalMachineReadyErrorCode;
|
|
106
|
+
serverUrl: string;
|
|
107
|
+
message: string;
|
|
108
|
+
canRetry: boolean;
|
|
109
|
+
};
|
|
110
|
+
interface ConnectorDeviceAuthorization extends DeviceAuthorization {
|
|
111
|
+
serverUrl: string;
|
|
112
|
+
}
|
|
113
|
+
declare function ensureLocalMachineReady(options: LocalMachineReadyOptions): Promise<LocalMachineReadyResult>;
|
|
114
|
+
declare function setupConnectorProfile(options: {
|
|
115
|
+
serverUrl: string;
|
|
116
|
+
store: TokenStore;
|
|
117
|
+
name?: string | undefined;
|
|
118
|
+
installService?: boolean | undefined;
|
|
119
|
+
serviceInstaller?: LocalMachineServiceInstaller | undefined;
|
|
120
|
+
allowInsecureTls?: boolean | undefined;
|
|
121
|
+
}): Promise<ClaimedMachine>;
|
|
122
|
+
declare function startConnectorDeviceAuthorization(options: {
|
|
123
|
+
serverUrl: string;
|
|
124
|
+
deviceLabel?: string | undefined;
|
|
125
|
+
allowInsecureTls?: boolean | undefined;
|
|
126
|
+
}): Promise<{
|
|
127
|
+
serverUrl: string;
|
|
128
|
+
deviceCode: string;
|
|
129
|
+
userCode: string;
|
|
130
|
+
verificationUri: string;
|
|
131
|
+
verificationUriComplete: string;
|
|
132
|
+
expiresIn: number;
|
|
133
|
+
interval: number;
|
|
134
|
+
}>;
|
|
135
|
+
declare function pollConnectorDeviceToken(options: {
|
|
136
|
+
serverUrl: string;
|
|
137
|
+
store: TokenStore;
|
|
138
|
+
deviceCode: string;
|
|
139
|
+
intervalSeconds: number;
|
|
140
|
+
expiresInSeconds: number;
|
|
141
|
+
allowInsecureTls?: boolean | undefined;
|
|
142
|
+
}): Promise<AuthProfile>;
|
|
143
|
+
declare function ensureAccessToken(input: {
|
|
144
|
+
serverUrl: string;
|
|
145
|
+
store: TokenStore;
|
|
146
|
+
authClient?: CliAuthClient | undefined;
|
|
147
|
+
now?: Date | undefined;
|
|
148
|
+
forceRefresh?: boolean | undefined;
|
|
149
|
+
allowInsecureTls?: boolean | undefined;
|
|
150
|
+
}): Promise<string>;
|
|
151
|
+
declare function createAccessTokenProvider(input: {
|
|
152
|
+
serverUrl: string;
|
|
153
|
+
store: TokenStore;
|
|
154
|
+
allowInsecureTls?: boolean | undefined;
|
|
155
|
+
}): (options?: AccessTokenProviderOptions) => Promise<string>;
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/service-manager.d.ts
|
|
158
|
+
interface ConnectorServiceConfigInput {
|
|
159
|
+
serverUrl?: string;
|
|
160
|
+
allowInsecureTls?: boolean;
|
|
161
|
+
profileName?: string;
|
|
162
|
+
connectorEntryPath?: string;
|
|
163
|
+
}
|
|
164
|
+
interface ConnectorServiceInstallResult {
|
|
165
|
+
platform: SupportedServicePlatform;
|
|
166
|
+
service: "launch-agent" | "systemd-user" | "windows-scheduled-task";
|
|
167
|
+
}
|
|
168
|
+
declare class ConnectorServiceUnsupportedError extends Error {
|
|
169
|
+
readonly code = "connector_service_unsupported";
|
|
170
|
+
constructor();
|
|
171
|
+
}
|
|
172
|
+
declare function isConnectorServiceUnsupportedError(error: unknown): error is ConnectorServiceUnsupportedError;
|
|
173
|
+
declare const SUPPORTED_SERVICE_PLATFORMS: readonly ["darwin", "linux", "win32"];
|
|
174
|
+
type SupportedServicePlatform = (typeof SUPPORTED_SERVICE_PLATFORMS)[number];
|
|
175
|
+
declare function installConnectorService(config: ConnectorServiceConfigInput): Promise<ConnectorServiceInstallResult>;
|
|
176
|
+
//#endregion
|
|
177
|
+
export { type AuthProfile, type ConnectorDeviceAuthorization, type ConnectorServiceInstallResult, ConnectorServiceUnsupportedError, type LocalMachineReadyErrorCode, type LocalMachineReadyOptions, type LocalMachineReadyResult, type LocalMachineServiceInstallInput, type LocalMachineServiceInstaller, type SupportedServicePlatform, TokenStore, type TokenStoreData, createAccessTokenProvider, defaultTokenStorePath, ensureAccessToken, ensureLocalMachineReady, installConnectorService, isConnectorServiceUnsupportedError, normalizeServerUrl, pollConnectorDeviceToken, setupConnectorProfile, startConnectorDeviceAuthorization };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as setupConnectorProfile, c as defaultTokenStorePath, d as installConnectorService, f as isConnectorServiceUnsupportedError, i as pollConnectorDeviceToken, l as normalizeServerUrl, n as ensureAccessToken, o as startConnectorDeviceAuthorization, r as ensureLocalMachineReady, s as TokenStore, t as createAccessTokenProvider, u as ConnectorServiceUnsupportedError } from "./local-machine-controller-Dtiash-C.js";
|
|
2
|
+
export { ConnectorServiceUnsupportedError, TokenStore, createAccessTokenProvider, defaultTokenStorePath, ensureAccessToken, ensureLocalMachineReady, installConnectorService, isConnectorServiceUnsupportedError, normalizeServerUrl, pollConnectorDeviceToken, setupConnectorProfile, startConnectorDeviceAuthorization };
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sipher.dev/agents",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "SIPHER Agents CLI and machine connector.",
|
|
6
|
+
"bin": {
|
|
7
|
+
"agent-connector": "dist/index.js",
|
|
8
|
+
"agents": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./local-machine": {
|
|
16
|
+
"types": "./dist/local-machine.d.ts",
|
|
17
|
+
"import": "./dist/local-machine.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsdown && chmod +x dist/index.js",
|
|
25
|
+
"dev": "tsx src/index.ts",
|
|
26
|
+
"start": "tsx src/index.ts",
|
|
27
|
+
"prepack": "pnpm build",
|
|
28
|
+
"check": "tsgo --noEmit",
|
|
29
|
+
"check:tsc": "tsc --noEmit",
|
|
30
|
+
"test": "tsx --test 'src/*.test.ts'"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@ff-labs/fff-node": "0.9.4",
|
|
34
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
35
|
+
"ws": "^8.21.0",
|
|
36
|
+
"zod": "^4.4.3"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^24.10.1",
|
|
40
|
+
"@types/ws": "^8.18.1",
|
|
41
|
+
"tsdown": "^0.22.3",
|
|
42
|
+
"tsx": "4.22.4"
|
|
43
|
+
},
|
|
44
|
+
"optionalDependencies": {
|
|
45
|
+
"node-pty": "1.1.0"
|
|
46
|
+
}
|
|
47
|
+
}
|