@amaster.ai/mirrorx-device-client 0.0.0-stage → 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/LICENSE +172 -0
- package/README.md +487 -2
- package/dist/codebuddy-auth.d.ts +2 -0
- package/dist/codebuddy-auth.d.ts.map +1 -0
- package/dist/codebuddy-auth.js +80 -0
- package/dist/codebuddy-auth.js.map +1 -0
- package/dist/codebuddy-locks.d.ts +12 -0
- package/dist/codebuddy-locks.d.ts.map +1 -0
- package/dist/codebuddy-locks.js +101 -0
- package/dist/codebuddy-locks.js.map +1 -0
- package/dist/codebuddy-redaction.d.ts +3 -0
- package/dist/codebuddy-redaction.d.ts.map +1 -0
- package/dist/codebuddy-redaction.js +31 -0
- package/dist/codebuddy-redaction.js.map +1 -0
- package/dist/codebuddy-runtime.d.ts +82 -0
- package/dist/codebuddy-runtime.d.ts.map +1 -0
- package/dist/codebuddy-runtime.js +285 -0
- package/dist/codebuddy-runtime.js.map +1 -0
- package/dist/codebuddy-session.d.ts +13 -0
- package/dist/codebuddy-session.d.ts.map +1 -0
- package/dist/codebuddy-session.js +73 -0
- package/dist/codebuddy-session.js.map +1 -0
- package/dist/codebuddy-tool-gate.d.ts +4 -0
- package/dist/codebuddy-tool-gate.d.ts.map +1 -0
- package/dist/codebuddy-tool-gate.js +10 -0
- package/dist/codebuddy-tool-gate.js.map +1 -0
- package/dist/codex-runtime.d.ts +6 -0
- package/dist/codex-runtime.d.ts.map +1 -0
- package/dist/codex-runtime.js +24 -0
- package/dist/codex-runtime.js.map +1 -0
- package/dist/computer.d.ts +25 -0
- package/dist/computer.d.ts.map +1 -0
- package/dist/computer.js +161 -0
- package/dist/computer.js.map +1 -0
- package/dist/configuration-lifetime.d.ts +15 -0
- package/dist/configuration-lifetime.d.ts.map +1 -0
- package/dist/configuration-lifetime.js +143 -0
- package/dist/configuration-lifetime.js.map +1 -0
- package/dist/device-id.d.ts +7 -0
- package/dist/device-id.d.ts.map +1 -0
- package/dist/device-id.js +84 -0
- package/dist/device-id.js.map +1 -0
- package/dist/index.d.ts +209 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1459 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +126 -0
- package/dist/main.js.map +1 -0
- package/dist/managed-workspace.d.ts +33 -0
- package/dist/managed-workspace.d.ts.map +1 -0
- package/dist/managed-workspace.js +149 -0
- package/dist/managed-workspace.js.map +1 -0
- package/dist/pi-runtime.d.ts +24 -0
- package/dist/pi-runtime.d.ts.map +1 -0
- package/dist/pi-runtime.js +156 -0
- package/dist/pi-runtime.js.map +1 -0
- package/dist/readiness.d.ts +12 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +66 -0
- package/dist/readiness.js.map +1 -0
- package/dist/resource-lock.d.ts +11 -0
- package/dist/resource-lock.d.ts.map +1 -0
- package/dist/resource-lock.js +74 -0
- package/dist/resource-lock.js.map +1 -0
- package/dist/session-index.d.ts +41 -0
- package/dist/session-index.d.ts.map +1 -0
- package/dist/session-index.js +99 -0
- package/dist/session-index.js.map +1 -0
- package/dist/user-service.d.ts +21 -0
- package/dist/user-service.d.ts.map +1 -0
- package/dist/user-service.js +224 -0
- package/dist/user-service.js.map +1 -0
- package/package.json +46 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** A connection profile is an OS-user namespace, never a hardware fingerprint. */
|
|
2
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3
|
+
import { chmod, link, lstat, mkdir, open, readFile, rename, unlink, writeFile } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
export function canonicalServerOrigin(value) {
|
|
7
|
+
const url = new URL(value);
|
|
8
|
+
if (url.username || url.password || !["http:", "https:"].includes(url.protocol)
|
|
9
|
+
|| url.protocol === "http:" && !["localhost", "127.0.0.1", "[::1]"].includes(url.hostname)) {
|
|
10
|
+
throw new Error("MirrorX URL must use HTTPS except for local development");
|
|
11
|
+
}
|
|
12
|
+
return url.origin;
|
|
13
|
+
}
|
|
14
|
+
export function mirrorxIdentityHome() {
|
|
15
|
+
return process.env.MIRRORX_DEVICE_IDENTITY_HOME?.trim()
|
|
16
|
+
? path.resolve(process.env.MIRRORX_DEVICE_IDENTITY_HOME.trim()) : path.join(os.homedir(), ".mirrorx-device", "identity");
|
|
17
|
+
}
|
|
18
|
+
export function identityNamespace(server, principalId) {
|
|
19
|
+
if (!principalId.trim())
|
|
20
|
+
throw new Error("Authenticated MirrorX principal required");
|
|
21
|
+
return createHash("sha256").update(JSON.stringify([canonicalServerOrigin(server), principalId])).digest("hex");
|
|
22
|
+
}
|
|
23
|
+
export async function readOrCreateDeviceProfile(server, principalId, retainedProfileId) {
|
|
24
|
+
const root = mirrorxIdentityHome();
|
|
25
|
+
await mkdir(root, { recursive: true, mode: 0o700 });
|
|
26
|
+
const file = path.join(root, `${identityNamespace(server, principalId)}.json`);
|
|
27
|
+
const temporary = `${file}.${randomUUID()}.tmp`;
|
|
28
|
+
const rootInfo = await lstat(root);
|
|
29
|
+
if (rootInfo.isSymbolicLink() || !rootInfo.isDirectory() || process.getuid && rootInfo.uid !== process.getuid())
|
|
30
|
+
throw new Error("Private identity directory ownership is invalid");
|
|
31
|
+
await chmod(root, 0o700);
|
|
32
|
+
const retained = retainedProfileId && /^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i.test(retainedProfileId) ? retainedProfileId : undefined;
|
|
33
|
+
const candidate = retained ?? randomUUID();
|
|
34
|
+
await writeFile(temporary, JSON.stringify({ schema: 2, deviceProfileId: candidate }), { mode: 0o600, flag: "wx" });
|
|
35
|
+
try {
|
|
36
|
+
// Publish complete bytes atomically; concurrent App/daemon readers never see
|
|
37
|
+
// an empty exclusive-created file and never overwrite the winner's UUID.
|
|
38
|
+
await link(temporary, file).catch(error => { if (error.code !== "EEXIST")
|
|
39
|
+
throw error; });
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
await unlink(temporary);
|
|
43
|
+
}
|
|
44
|
+
const info = await lstat(file);
|
|
45
|
+
if (info.isSymbolicLink() || !info.isFile() || process.getuid && info.uid !== process.getuid())
|
|
46
|
+
throw new Error("Private identity file ownership is invalid");
|
|
47
|
+
await chmod(file, 0o600);
|
|
48
|
+
const bytes = await readFile(file, "utf8");
|
|
49
|
+
let profile;
|
|
50
|
+
try {
|
|
51
|
+
profile = JSON.parse(bytes);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
profile = null;
|
|
55
|
+
}
|
|
56
|
+
if (retained && (!profile || typeof profile !== "object" || !("deviceProfileId" in profile) || profile.deviceProfileId !== retained)) {
|
|
57
|
+
// The caller obtained this exact profile from a valid narrow server
|
|
58
|
+
// session, never from a local hint. Serialize and compare before repair.
|
|
59
|
+
const repair = await open(`${file}.repair`, "wx", 0o600);
|
|
60
|
+
const replacement = `${file}.${randomUUID()}.repair-tmp`;
|
|
61
|
+
try {
|
|
62
|
+
if (await readFile(file, "utf8") !== bytes)
|
|
63
|
+
throw new Error("Identity changed during authenticated repair");
|
|
64
|
+
if (profile && typeof profile === "object" && "deviceProfileId" in profile && typeof profile.deviceProfileId === "string")
|
|
65
|
+
throw new Error("Conflicting retained connection identities; explicit restore required");
|
|
66
|
+
await writeFile(replacement, JSON.stringify({ schema: 2, deviceProfileId: retained }), { mode: 0o600, flag: "wx" });
|
|
67
|
+
await rename(replacement, file);
|
|
68
|
+
profile = { deviceProfileId: retained };
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
await repair.close();
|
|
72
|
+
await unlink(`${file}.repair`);
|
|
73
|
+
await unlink(replacement).catch(() => undefined);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (!profile || typeof profile !== "object" || !("deviceProfileId" in profile)
|
|
77
|
+
|| typeof profile.deviceProfileId !== "string" || !/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i.test(profile.deviceProfileId)) {
|
|
78
|
+
throw new Error("Connection identity index is damaged; recover it from the original binding");
|
|
79
|
+
}
|
|
80
|
+
return profile.deviceProfileId;
|
|
81
|
+
}
|
|
82
|
+
/** @deprecated Retained export for older embedders. Never reads OS identifiers. */
|
|
83
|
+
export async function readDesktopDeviceId() { return undefined; }
|
|
84
|
+
//# sourceMappingURL=device-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-id.js","sourceRoot":"","sources":["../src/device-id.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,qBAAqB,CAAC,KAAa;IACjD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;WAC1E,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7F,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC;AACD,MAAM,UAAU,mBAAmB;IACjC,OAAO,OAAO,CAAC,GAAG,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AC,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAAC,CAAC;IACvH,CAAC;IACD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,CAAC,iBAAiB,IAAI,OAAO,CAAC;WACzE,OAAO,OAAO,CAAC,eAAe,KAAK,QAAQ,IAAI,CAAC,gDAAgD,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QACpI,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAChG,CAAC;IACD,OAAO,OAAO,CAAC,eAAe,CAAC;AACjC,CAAC;AACD,mFAAmF;AACnF,MAAM,CAAC,KAAK,UAAU,mBAAmB,KAAyB,OAAO,SAAS,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { type PiDeviceRuntime } from "./pi-runtime.js";
|
|
2
|
+
export type { PiDeviceRuntime } from "./pi-runtime.js";
|
|
3
|
+
export type ExecutorKind = "pi" | "codex" | "codebuddy";
|
|
4
|
+
export type DeviceRegistrationFailure = {
|
|
5
|
+
companyId: string;
|
|
6
|
+
status: number;
|
|
7
|
+
error: string;
|
|
8
|
+
code?: "active_session" | "PI_IDENTITY_CHOICE_REQUIRED" | "DEVICE_REVOKED" | "DEVICE_RECOVERY_REQUIRED" | "DEVICE_BUSY" | "DEVICE_RECONCILIATION_REQUIRED";
|
|
9
|
+
sessionId?: string;
|
|
10
|
+
retryable?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type DeviceConfig = {
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
userSubject?: string;
|
|
15
|
+
managedBy?: "desktop" | "standalone";
|
|
16
|
+
signedOut?: boolean;
|
|
17
|
+
principalId?: string;
|
|
18
|
+
deviceProfileId?: string;
|
|
19
|
+
computerId?: string;
|
|
20
|
+
generation?: number;
|
|
21
|
+
companyId: string;
|
|
22
|
+
deviceId: string;
|
|
23
|
+
executorKind: ExecutorKind;
|
|
24
|
+
workspaceRoot: string;
|
|
25
|
+
workspaceMode?: "managed" | "custom";
|
|
26
|
+
agentId: string;
|
|
27
|
+
bindingId: string;
|
|
28
|
+
sessionId: string;
|
|
29
|
+
deviceToken: string;
|
|
30
|
+
};
|
|
31
|
+
export declare class DeviceRequestError extends Error {
|
|
32
|
+
readonly status: number;
|
|
33
|
+
readonly code?: string | undefined;
|
|
34
|
+
constructor(status: number, method: string, route: string, code?: string | undefined);
|
|
35
|
+
}
|
|
36
|
+
export declare function mirrorxDeviceHome(): string;
|
|
37
|
+
export declare function hasMirrorxDevicePairing(kind: ExecutorKind): Promise<boolean>;
|
|
38
|
+
/** Redeem a one-use code created by the signed-in MirrorX user. */
|
|
39
|
+
export declare function pairMirrorxDevice(input: {
|
|
40
|
+
baseUrl: string;
|
|
41
|
+
code: string;
|
|
42
|
+
executorKind: ExecutorKind;
|
|
43
|
+
workspaceRoot?: string;
|
|
44
|
+
}): Promise<Omit<DeviceConfig, "deviceToken">>;
|
|
45
|
+
/** Reuse the Pi login's IAM bearer; no second browser approval or board key. */
|
|
46
|
+
export declare function enrollMirrorxDevice(input: {
|
|
47
|
+
baseUrl: string;
|
|
48
|
+
iamAccessToken: string;
|
|
49
|
+
userSubject: string;
|
|
50
|
+
executorKind: ExecutorKind;
|
|
51
|
+
companyIds?: string[];
|
|
52
|
+
signal?: AbortSignal;
|
|
53
|
+
onRegistrationFailure?: (failure: DeviceRegistrationFailure) => void;
|
|
54
|
+
}): Promise<Array<Omit<DeviceConfig, "deviceToken">>>;
|
|
55
|
+
/** Non-sensitive inspection; restoration never scans unselected tools. */
|
|
56
|
+
export declare function listMirrorxDevicePairings(input: {
|
|
57
|
+
expectedSubject?: string;
|
|
58
|
+
expectedBaseUrl?: string;
|
|
59
|
+
executorKind?: ExecutorKind;
|
|
60
|
+
}): Promise<{
|
|
61
|
+
baseUrl: string;
|
|
62
|
+
userSubject?: string;
|
|
63
|
+
managedBy?: "desktop" | "standalone";
|
|
64
|
+
signedOut?: boolean;
|
|
65
|
+
principalId?: string;
|
|
66
|
+
deviceProfileId?: string;
|
|
67
|
+
computerId?: string;
|
|
68
|
+
generation?: number;
|
|
69
|
+
companyId: string;
|
|
70
|
+
deviceId: string;
|
|
71
|
+
executorKind: ExecutorKind;
|
|
72
|
+
workspaceRoot: string;
|
|
73
|
+
workspaceMode?: "managed" | "custom";
|
|
74
|
+
agentId: string;
|
|
75
|
+
bindingId: string;
|
|
76
|
+
sessionId: string;
|
|
77
|
+
}[]>;
|
|
78
|
+
/** Restore credentials only for a retained, explicitly authorized desktop tool.
|
|
79
|
+
* A live Pi session proves the same account/company/profile to the server. */
|
|
80
|
+
export declare function restoreMirrorxToolSession(input: {
|
|
81
|
+
expectedSubject: string;
|
|
82
|
+
expectedBaseUrl: string;
|
|
83
|
+
bindingId: string;
|
|
84
|
+
executorKind: ExecutorKind;
|
|
85
|
+
signal?: AbortSignal;
|
|
86
|
+
}): Promise<void>;
|
|
87
|
+
export declare function getMirrorxEnrollmentIntent(input: {
|
|
88
|
+
baseUrl: string;
|
|
89
|
+
iamAccessToken: string;
|
|
90
|
+
userSubject: string;
|
|
91
|
+
enrollmentIntentId: string;
|
|
92
|
+
}): Promise<{
|
|
93
|
+
enrollmentIntentId: string;
|
|
94
|
+
principalId: string;
|
|
95
|
+
subject: string;
|
|
96
|
+
companyId: string;
|
|
97
|
+
executorKind: ExecutorKind;
|
|
98
|
+
recoveryBindingId?: string | null;
|
|
99
|
+
explicitPiChoice?: boolean;
|
|
100
|
+
enrollment: {
|
|
101
|
+
name: string;
|
|
102
|
+
role: string;
|
|
103
|
+
workspaceRoot: string;
|
|
104
|
+
workspaceMode?: "managed" | "custom";
|
|
105
|
+
targetBindingId?: string;
|
|
106
|
+
};
|
|
107
|
+
bindingId: string | null;
|
|
108
|
+
expiresAt: string;
|
|
109
|
+
}>;
|
|
110
|
+
export declare function connectMirrorxEnrollmentIntent(input: {
|
|
111
|
+
baseUrl: string;
|
|
112
|
+
iamAccessToken: string;
|
|
113
|
+
userSubject: string;
|
|
114
|
+
enrollmentIntentId: string;
|
|
115
|
+
workspaceRoot?: string;
|
|
116
|
+
confirmed?: true;
|
|
117
|
+
signal?: AbortSignal;
|
|
118
|
+
}): Promise<{
|
|
119
|
+
baseUrl: string;
|
|
120
|
+
userSubject?: string;
|
|
121
|
+
managedBy?: "desktop" | "standalone";
|
|
122
|
+
signedOut?: boolean;
|
|
123
|
+
principalId?: string;
|
|
124
|
+
deviceProfileId?: string;
|
|
125
|
+
computerId?: string;
|
|
126
|
+
generation?: number;
|
|
127
|
+
companyId: string;
|
|
128
|
+
deviceId: string;
|
|
129
|
+
executorKind: ExecutorKind;
|
|
130
|
+
workspaceRoot: string;
|
|
131
|
+
workspaceMode?: "managed" | "custom";
|
|
132
|
+
agentId: string;
|
|
133
|
+
bindingId: string;
|
|
134
|
+
sessionId: string;
|
|
135
|
+
}>;
|
|
136
|
+
export declare function runMirrorxDevices(input: {
|
|
137
|
+
executorKind: ExecutorKind;
|
|
138
|
+
expectedSubject?: string;
|
|
139
|
+
expectedBaseUrl?: string;
|
|
140
|
+
signal?: AbortSignal;
|
|
141
|
+
drainSignal?: AbortSignal;
|
|
142
|
+
companyIds?: string[];
|
|
143
|
+
bindingIds?: string[];
|
|
144
|
+
/** The automatic desktop bridge must never also run managed employee bindings. */
|
|
145
|
+
computerCarrierOnly?: boolean;
|
|
146
|
+
piRuntime?: PiDeviceRuntime;
|
|
147
|
+
onManagedIntent?(enrollmentIntentId: string): Promise<void>;
|
|
148
|
+
onState?(state: string): void;
|
|
149
|
+
onConnectionState?(companyId: string, state: "connected" | "retrying" | "failed"): void;
|
|
150
|
+
}): Promise<void>;
|
|
151
|
+
/** Revoke the narrow device sessions when the user signs out of Pi. */
|
|
152
|
+
export declare function disconnectMirrorxDevices(kind: ExecutorKind, userSubject: string): Promise<void>;
|
|
153
|
+
/** Local operator recovery only: this neither acknowledges nor relaunches the command. */
|
|
154
|
+
export declare function reclaimMirrorxDeviceConfiguration(input: {
|
|
155
|
+
executorKind: ExecutorKind;
|
|
156
|
+
companyId: string;
|
|
157
|
+
bindingId?: string;
|
|
158
|
+
commandId: string;
|
|
159
|
+
confirmedStopped: boolean;
|
|
160
|
+
}): Promise<void>;
|
|
161
|
+
/** Operator reset discards native context only; the original command still needs reconciliation. */
|
|
162
|
+
export declare function resetMirrorxCodebuddySession(input: {
|
|
163
|
+
companyId: string;
|
|
164
|
+
sessionKey: string;
|
|
165
|
+
sessionId: string;
|
|
166
|
+
confirmedStopped: boolean;
|
|
167
|
+
}): Promise<void>;
|
|
168
|
+
export declare function runMirrorxDevice(input: {
|
|
169
|
+
executorKind: ExecutorKind;
|
|
170
|
+
companyId?: string;
|
|
171
|
+
bindingId?: string;
|
|
172
|
+
drainSignal?: AbortSignal;
|
|
173
|
+
expectedSubject?: string;
|
|
174
|
+
expectedBaseUrl?: string;
|
|
175
|
+
piRuntime?: PiDeviceRuntime;
|
|
176
|
+
onManagedIntent?(enrollmentIntentId: string): Promise<void>;
|
|
177
|
+
signal?: AbortSignal;
|
|
178
|
+
onState?(state: string): void;
|
|
179
|
+
onConnectionState?(state: "connected" | "retrying" | "failed"): void;
|
|
180
|
+
}): Promise<void>;
|
|
181
|
+
/** Resolve only exact references owned by this login and canonical service. */
|
|
182
|
+
export declare function findMirrorxDeviceSession(input: {
|
|
183
|
+
expectedSubject: string;
|
|
184
|
+
expectedBaseUrl: string;
|
|
185
|
+
sessionId: string;
|
|
186
|
+
}): Promise<import("./session-index.js").DeviceSessionReference | undefined>;
|
|
187
|
+
/** Computer-only enrollment can claim only a web-authorized managed employee. */
|
|
188
|
+
export declare function connectMirrorxComputerIntent(input: {
|
|
189
|
+
baseUrl: string;
|
|
190
|
+
computerId: string;
|
|
191
|
+
principalId: string;
|
|
192
|
+
companyId: string;
|
|
193
|
+
deviceProfileId: string;
|
|
194
|
+
computerToken: string;
|
|
195
|
+
enrollmentIntentId: string;
|
|
196
|
+
signal?: AbortSignal;
|
|
197
|
+
}): Promise<{
|
|
198
|
+
bindingId: string;
|
|
199
|
+
executorKind: ExecutorKind;
|
|
200
|
+
}>;
|
|
201
|
+
export declare function restoreMirrorxComputerEmployee(input: {
|
|
202
|
+
baseUrl: string;
|
|
203
|
+
computerId: string;
|
|
204
|
+
computerToken: string;
|
|
205
|
+
bindingId: string;
|
|
206
|
+
executorKind: ExecutorKind;
|
|
207
|
+
signal?: AbortSignal;
|
|
208
|
+
}): Promise<void>;
|
|
209
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAA6C,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AASlG,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,OAAO,GAAG,WAAW,CAAC;AACxD,MAAM,MAAM,yBAAyB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IACzF,IAAI,CAAC,EAAE,gBAAgB,GAAG,6BAA6B,GAAG,gBAAgB,GAAG,0BAA0B,GAAG,aAAa,GAAG,gCAAgC,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AACxM,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAA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