@agimon-ai/po-remote 0.0.0-alpha.170
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 +149 -0
- package/README.md +28 -0
- package/dist/apiContracts.cjs +17 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +13 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/extensions/server.cjs +30 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +25 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +1464 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +6190 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +553 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6159 -0
- package/dist/index.mjs.map +1 -0
- package/dist/po-runtime-identity.json +1 -0
- package/llms.txt +13 -0
- package/package.json +158 -0
- package/src/prompts/help-how-to-remote/SKILL.md +23 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
import { PoClientMetadata } from "@agimon-ai/po-core/clientMetadata";
|
|
2
|
+
import { PoApi, PoFederationCaller, PoRegisteredFile, PoSharedFile } from "@agimon-ai/po-core/packageApi";
|
|
3
|
+
import { ProtocolLink } from "@agimon-ai/po-core/protocolTransport";
|
|
4
|
+
import { BundlePairingTrust, NativePushRegistration, PairingStatus, RemoteAccessSettings, RemoteAccessStateView, RemoteChannelScope, TunnelLauncher } from "@agimon-ai/po-core/remoteContract";
|
|
5
|
+
import { ServerTelemetry } from "@agimon-ai/po-core/serverTelemetry";
|
|
6
|
+
import { Context, Hono } from "hono";
|
|
7
|
+
import { WebSocket } from "ws";
|
|
8
|
+
import { AuthPairingIdentity, AuthPairingRequest, FederationEnvelope, FederationFireOutcome, FederationFireRequest } from "@agimon-ai/po-core";
|
|
9
|
+
import { HubFederationPlatform, HubTrustState } from "@agimon-ai/po-federation";
|
|
10
|
+
import "@agimon-ai/po-web-security/deviceProof";
|
|
11
|
+
import "@earendil-works/chord/context";
|
|
12
|
+
import { PoRemoteGateway } from "@agimon-ai/po-core/serverPlugin";
|
|
13
|
+
import { SealedChannel } from "@agimon-ai/po-web-security/node";
|
|
14
|
+
import "@earendil-works/pi-durable/env";
|
|
15
|
+
import { CallerAccess, HostTeam } from "@agimon-ai/po-core/headlessServer";
|
|
16
|
+
//#region src/types/remote.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* How a live session earned its cookie. Only a `pairing` session approved by QR may register a native
|
|
19
|
+
* device, and a `device-key` session always needs a biometric step-up signature for gated actions.
|
|
20
|
+
*/
|
|
21
|
+
type DeviceTrustKind = 'pairing' | 'passkey' | 'device-key';
|
|
22
|
+
type DeviceTrust = {
|
|
23
|
+
kind: 'pairing';
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'passkey';
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'device-key';
|
|
28
|
+
trustedDeviceId: string;
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/services/deviceSessions/index.d.ts
|
|
32
|
+
interface DeviceRecord {
|
|
33
|
+
/** Opaque, safe to display and to name in a revoke call. Never the secret. */
|
|
34
|
+
id: string;
|
|
35
|
+
/** SHA-256 of the session token. The token itself is never retained. */
|
|
36
|
+
tokenHash: string;
|
|
37
|
+
label: string;
|
|
38
|
+
userAgent: string;
|
|
39
|
+
/** Epoch milliseconds. */
|
|
40
|
+
createdAt: number;
|
|
41
|
+
/** Epoch milliseconds, bumped on every authenticated request. */
|
|
42
|
+
lastSeenAt: number;
|
|
43
|
+
/** How this session was earned; decides registration rights and step-up. */
|
|
44
|
+
trust: DeviceTrust;
|
|
45
|
+
/** The issuer-verified member bound before host approval, separate from any owner capability. */
|
|
46
|
+
account?: AuthPairingIdentity;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/services/deviceAuth/index.d.ts
|
|
50
|
+
interface EnrolledDevice {
|
|
51
|
+
/** Returned exactly once, to be sent as the cookie value. Only its digest is retained. */
|
|
52
|
+
token: string;
|
|
53
|
+
record: DeviceRecord;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/services/pairingFlow/index.d.ts
|
|
57
|
+
interface PairingRequest {
|
|
58
|
+
id: string;
|
|
59
|
+
userAgent: string;
|
|
60
|
+
edgeIp: string;
|
|
61
|
+
createdAt: number;
|
|
62
|
+
status: PairingStatus;
|
|
63
|
+
/** This claimant must prove its signed-in account before the host can approve it. */
|
|
64
|
+
accountRequired?: boolean;
|
|
65
|
+
account?: AuthPairingIdentity;
|
|
66
|
+
}
|
|
67
|
+
type ClaimOutcome = {
|
|
68
|
+
ok: true;
|
|
69
|
+
requestId: string;
|
|
70
|
+
} | {
|
|
71
|
+
ok: false;
|
|
72
|
+
code: 'unknown_code' | 'rate_limited';
|
|
73
|
+
};
|
|
74
|
+
interface PairingFlow {
|
|
75
|
+
/** Mints a QR token and a separate manual code. Replaces the previous pair. */
|
|
76
|
+
mintCode(): {
|
|
77
|
+
code: string;
|
|
78
|
+
manualCode: string;
|
|
79
|
+
expiresAt: number;
|
|
80
|
+
};
|
|
81
|
+
claim(input: {
|
|
82
|
+
code: string;
|
|
83
|
+
userAgent: string | undefined;
|
|
84
|
+
edgeIp: string | undefined;
|
|
85
|
+
/** Source normalized by the adapter from trusted proxy metadata or the socket peer. */
|
|
86
|
+
sourceAddress: string | undefined;
|
|
87
|
+
accountRequired?: boolean;
|
|
88
|
+
}): ClaimOutcome;
|
|
89
|
+
status(requestId: string): PairingStatus | undefined;
|
|
90
|
+
/** Internal only: the adapter resolves the issuer's one-use proof before calling this. */
|
|
91
|
+
bindAccount(requestId: string, account: AuthPairingIdentity): boolean;
|
|
92
|
+
approve(requestId: string): 'approved' | 'unknown' | 'expired' | 'settled' | 'account-required';
|
|
93
|
+
deny(requestId: string): 'denied' | 'unknown' | 'settled';
|
|
94
|
+
/** Takes an approved request exactly once, returning what the device record needs. */
|
|
95
|
+
consume(requestId: string): {
|
|
96
|
+
userAgent: string;
|
|
97
|
+
account?: AuthPairingIdentity;
|
|
98
|
+
} | undefined;
|
|
99
|
+
pending(): readonly PairingRequest[];
|
|
100
|
+
/** Drops what has aged out. Only reclaims memory; expiry is derived, not scheduled. */
|
|
101
|
+
sweep(): void;
|
|
102
|
+
clear(): void;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/services/webauthnPolicy/index.d.ts
|
|
106
|
+
/**
|
|
107
|
+
* Actions that need a fresh gesture even from a live session.
|
|
108
|
+
*
|
|
109
|
+
* These are escalation paths rather than ordinary prompting or tool approval:
|
|
110
|
+
* credentials redirect machine traffic, sessions run code in a selected directory,
|
|
111
|
+
* repository writes change future sessions, and live MCP operations may start local
|
|
112
|
+
* processes or contact remote servers.
|
|
113
|
+
*/
|
|
114
|
+
declare const STEP_UP_ACTIONS: readonly ['provider.login', 'provider.logout', 'session.create', 'settings.write', 'mcp.discover', 'mcp.authorize', 'computer-use.activate', 'device.revoke', 'peer.link'];
|
|
115
|
+
type StepUpAction = (typeof STEP_UP_ACTIONS)[number];
|
|
116
|
+
interface StoredCredential {
|
|
117
|
+
/** Opaque handle for display and revocation. */
|
|
118
|
+
id: string;
|
|
119
|
+
/** The authenticator's credential id, base64url, as WebAuthn reports it. */
|
|
120
|
+
credentialId: string;
|
|
121
|
+
/** Base64url public key; the private half never leaves the device. */
|
|
122
|
+
publicKey: string;
|
|
123
|
+
/** Signature counter, for clone detection. */
|
|
124
|
+
counter: number;
|
|
125
|
+
transports: string[];
|
|
126
|
+
label: string;
|
|
127
|
+
createdAt: number;
|
|
128
|
+
lastUsedAt: number;
|
|
129
|
+
/** The member bound at registration, retained across restart and restored only after this credential verifies. */
|
|
130
|
+
account?: AuthPairingIdentity;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/services/remoteGuardPolicy/index.d.ts
|
|
134
|
+
/**
|
|
135
|
+
* Who may do what, on which listener.
|
|
136
|
+
*
|
|
137
|
+
* The cockpit runs one Hono app behind two sockets: a loopback listener that is
|
|
138
|
+
* open to whoever already has an account on the machine, and a tunnel listener
|
|
139
|
+
* that faces the public internet. Every decision here answers one question
|
|
140
|
+
* about one request, with no I/O, so the whole trust boundary is readable in a
|
|
141
|
+
* single sitting and testable without a server.
|
|
142
|
+
*/
|
|
143
|
+
type GuardListener = 'local' | 'tunnel';
|
|
144
|
+
interface OriginPolicy {
|
|
145
|
+
origins: ReadonlySet<string>;
|
|
146
|
+
hosts: ReadonlySet<string>;
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/services/webauthn/index.d.ts
|
|
150
|
+
type PasskeySupport = {
|
|
151
|
+
supported: true;
|
|
152
|
+
rpId: string;
|
|
153
|
+
} | {
|
|
154
|
+
supported: false;
|
|
155
|
+
reason: string;
|
|
156
|
+
};
|
|
157
|
+
interface BegunCeremony {
|
|
158
|
+
ceremonyId: string;
|
|
159
|
+
options: Record<string, unknown>;
|
|
160
|
+
}
|
|
161
|
+
interface WebAuthn {
|
|
162
|
+
/** Whether the current tunnel can carry passkeys at all. */
|
|
163
|
+
support(): PasskeySupport;
|
|
164
|
+
beginRegistration(caller: string, label: string): Promise<BegunCeremony | undefined>;
|
|
165
|
+
finishRegistration(ceremonyId: string, caller: string, response: unknown, label: string): Promise<{
|
|
166
|
+
ok: true;
|
|
167
|
+
id: string;
|
|
168
|
+
} | {
|
|
169
|
+
ok: false;
|
|
170
|
+
error: string;
|
|
171
|
+
}>;
|
|
172
|
+
beginAuthentication(caller: string): Promise<BegunCeremony | undefined>;
|
|
173
|
+
finishAuthentication(ceremonyId: string, caller: string, response: unknown): Promise<{
|
|
174
|
+
ok: true;
|
|
175
|
+
credential: StoredCredential;
|
|
176
|
+
} | {
|
|
177
|
+
ok: false;
|
|
178
|
+
error: string;
|
|
179
|
+
}>;
|
|
180
|
+
/** Mints a challenge bound to one caller and action, good once and briefly. */
|
|
181
|
+
beginStepUp(caller: string, action: StepUpAction): Promise<BegunCeremony | undefined>;
|
|
182
|
+
finishStepUp(ceremonyId: string, caller: string, action: StepUpAction, response: unknown): Promise<boolean>;
|
|
183
|
+
clearChallenges(): void;
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/services/remoteAccess/index.d.ts
|
|
187
|
+
interface RemoteAccess {
|
|
188
|
+
state(selfDeviceId?: string, forLocalCaller?: boolean): RemoteAccessStateView;
|
|
189
|
+
settings(): RemoteAccessSettings;
|
|
190
|
+
updateSettings(patch: Partial<RemoteAccessSettings>): RemoteAccessSettings;
|
|
191
|
+
tunnelPort(): number | undefined;
|
|
192
|
+
/** The public origin the tunnel currently answers on, while one is up. */
|
|
193
|
+
publicOrigin(): string | undefined;
|
|
194
|
+
/** Changes whenever the public origin is established or torn down. */
|
|
195
|
+
publicOriginRevision(): number;
|
|
196
|
+
tunnelPolicy(): OriginPolicy | undefined;
|
|
197
|
+
/** An absolute deadline, preserved even when settings later disable or lengthen auto-close. */
|
|
198
|
+
enable(closesAt?: number): Promise<{
|
|
199
|
+
ok: true;
|
|
200
|
+
} | {
|
|
201
|
+
ok: false;
|
|
202
|
+
error: string;
|
|
203
|
+
}>;
|
|
204
|
+
disable(): Promise<void>;
|
|
205
|
+
/** Mints the QR credential, separate manual code, and URL. Undefined while unavailable. */
|
|
206
|
+
mintPairing(): ({
|
|
207
|
+
code: string;
|
|
208
|
+
manualCode: string;
|
|
209
|
+
pairUrl: string;
|
|
210
|
+
expiresAt: string;
|
|
211
|
+
} & BundlePairingTrust) | undefined;
|
|
212
|
+
bundleTrust(): BundlePairingTrust | undefined;
|
|
213
|
+
claim(input: {
|
|
214
|
+
code: string;
|
|
215
|
+
userAgent: string | undefined;
|
|
216
|
+
edgeIp: string | undefined;
|
|
217
|
+
sourceAddress: string | undefined;
|
|
218
|
+
accountRequired?: boolean;
|
|
219
|
+
}): ReturnType<PairingFlow['claim']>;
|
|
220
|
+
pairingStatus(requestId: string): PairingStatus | undefined;
|
|
221
|
+
/** Called only with the account resolved from the issuer's proof, never caller fields. */
|
|
222
|
+
bindPairingAccount(requestId: string, account: AuthPairingIdentity): boolean;
|
|
223
|
+
approve(requestId: string): ReturnType<PairingFlow['approve']>;
|
|
224
|
+
deny(requestId: string): ReturnType<PairingFlow['deny']>;
|
|
225
|
+
/** Turns an approved request into a session, exactly once. */
|
|
226
|
+
redeem(requestId: string): (EnrolledDevice & {
|
|
227
|
+
maxAgeSeconds: number;
|
|
228
|
+
}) | undefined;
|
|
229
|
+
authorize(token: string | undefined): string | undefined;
|
|
230
|
+
/** The account this live pairing names. Undefined never means a previously named member became the owner. */
|
|
231
|
+
accountOf(deviceId: string): AuthPairingIdentity | undefined;
|
|
232
|
+
/** Liveness check for a server-authenticated device identity, without extending expiry. */
|
|
233
|
+
isDeviceAuthorized(deviceId: string): boolean;
|
|
234
|
+
/** Mints a session for a device that proved a registered passkey. */
|
|
235
|
+
sessionForPasskey(label: string, account?: AuthPairingIdentity): EnrolledDevice & {
|
|
236
|
+
maxAgeSeconds: number;
|
|
237
|
+
};
|
|
238
|
+
passkeys(): {
|
|
239
|
+
support: () => PasskeySupport;
|
|
240
|
+
list: () => readonly StoredCredential[];
|
|
241
|
+
beginRegistration: WebAuthn['beginRegistration'];
|
|
242
|
+
finishRegistration: WebAuthn['finishRegistration'];
|
|
243
|
+
beginAuthentication: WebAuthn['beginAuthentication'];
|
|
244
|
+
finishAuthentication: WebAuthn['finishAuthentication'];
|
|
245
|
+
beginStepUp: WebAuthn['beginStepUp'];
|
|
246
|
+
finishStepUp: WebAuthn['finishStepUp'];
|
|
247
|
+
forget: (id: string) => boolean;
|
|
248
|
+
};
|
|
249
|
+
/** Registers a native device from a sealed, QR-approved pairing session, exactly once. */
|
|
250
|
+
registerTrustedDevice(sessionDeviceId: string, body: unknown): {
|
|
251
|
+
ok: true;
|
|
252
|
+
trustedDeviceId: string;
|
|
253
|
+
} | {
|
|
254
|
+
ok: false;
|
|
255
|
+
reason: 'forbidden' | 'invalid' | 'full' | 'unavailable' | 'persistence';
|
|
256
|
+
};
|
|
257
|
+
/** Server derives durable ownership from a live device-key session. Undefined body clears self. */
|
|
258
|
+
setNativePushRegistration(sessionDeviceId: string, body: unknown): {
|
|
259
|
+
ok: true;
|
|
260
|
+
notificationId: string;
|
|
261
|
+
} | {
|
|
262
|
+
ok: false;
|
|
263
|
+
reason: 'forbidden' | 'invalid' | 'persistence';
|
|
264
|
+
};
|
|
265
|
+
listNativePushRegistrations(): Array<{
|
|
266
|
+
notificationId: string;
|
|
267
|
+
registration: NativePushRegistration;
|
|
268
|
+
}>;
|
|
269
|
+
/** Compare-and-clear protects a newly rotated token from a stale provider failure. */
|
|
270
|
+
clearNativePushRegistration(notificationId: string, expectedRegistration: NativePushRegistration): boolean;
|
|
271
|
+
/** Public reconnect challenge with the same shape for known and unknown ids. */
|
|
272
|
+
beginDeviceAuth(input: {
|
|
273
|
+
trustedDeviceId: unknown;
|
|
274
|
+
nonce: unknown;
|
|
275
|
+
}): {
|
|
276
|
+
ok: true;
|
|
277
|
+
challengeId: string;
|
|
278
|
+
challenge: string;
|
|
279
|
+
hostPublicKey: string;
|
|
280
|
+
attestation: string;
|
|
281
|
+
} | {
|
|
282
|
+
ok: false;
|
|
283
|
+
reason: 'invalid' | 'unavailable';
|
|
284
|
+
};
|
|
285
|
+
/** Verifies a device sign-in, opens all three channels at once, and mints a session. */
|
|
286
|
+
finishDeviceAuth(body: unknown): (EnrolledDevice & {
|
|
287
|
+
maxAgeSeconds: number;
|
|
288
|
+
}) | undefined;
|
|
289
|
+
beginDeviceStepUp(sessionDeviceId: string, action: StepUpAction): {
|
|
290
|
+
ceremonyId: string;
|
|
291
|
+
challenge: string;
|
|
292
|
+
kind: 'device-key';
|
|
293
|
+
} | undefined;
|
|
294
|
+
finishDeviceStepUp(sessionDeviceId: string, action: StepUpAction, ceremonyId: unknown, signature: unknown): boolean;
|
|
295
|
+
/** Removes the stored device and ends every live session, channel, and socket it holds. */
|
|
296
|
+
revokeTrustedDevice(id: string): boolean;
|
|
297
|
+
trustKind(deviceId: string): DeviceTrustKind | undefined;
|
|
298
|
+
/** The trusted device a session signed back in as with its device key. Undefined for a first pairing. */
|
|
299
|
+
trustedDeviceOf(deviceId: string): string | undefined;
|
|
300
|
+
/**
|
|
301
|
+
* Whether this action needs a fresh gesture that has not been supplied. Always true for a device-key
|
|
302
|
+
* session; otherwise only where passkeys are supported.
|
|
303
|
+
*/
|
|
304
|
+
stepUpRequired(action: StepUpAction, deviceId?: string): boolean;
|
|
305
|
+
/** The host's ephemeral public key for this tunnel, delivered after QR pairing or passkey sign-in. */
|
|
306
|
+
channelPublicKey(): string | undefined;
|
|
307
|
+
/** Completes one purpose-bound sealed channel against a fresh device key. */
|
|
308
|
+
openChannel(deviceId: string, scope: RemoteChannelScope, clientPublicKey: string): boolean;
|
|
309
|
+
channelFor(deviceId: string, scope: RemoteChannelScope): SealedChannel | undefined;
|
|
310
|
+
revokeDevice(id: string): boolean;
|
|
311
|
+
isDeviceConnected(deviceId: string): boolean;
|
|
312
|
+
/** Registers a remote socket against its device so revocation closes it immediately. */
|
|
313
|
+
trackSocket(deviceId: string, close: (code: number, reason: string) => void): () => void;
|
|
314
|
+
close(): Promise<void>;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/services/remoteRoutes/index.d.ts
|
|
318
|
+
interface RemoteRoutesOptions {
|
|
319
|
+
remote: RemoteAccess;
|
|
320
|
+
federationHost?(): {
|
|
321
|
+
hostId: string;
|
|
322
|
+
hostPublicKey: string;
|
|
323
|
+
enrollmentGeneration?: number;
|
|
324
|
+
} | undefined;
|
|
325
|
+
/** Consumes only the local issuer's account proof, bound to this request and host. */
|
|
326
|
+
pairingAccount?: (proof: string, request: AuthPairingRequest) => Promise<AuthPairingIdentity | undefined>;
|
|
327
|
+
/** Enables the account step on the remote pairing page, never on local attach or personal QR pairing. */
|
|
328
|
+
accountPairing?(): boolean;
|
|
329
|
+
bindAccountDevice?: (pairingId: string, trustedDeviceId: string) => Promise<boolean>;
|
|
330
|
+
unlinkAccount?: (sealedDeviceId: string) => Promise<boolean>;
|
|
331
|
+
claimAccount?: (claim: import('@agimon-ai/po-core').FederationEnvelope<'po/hub-claim/v1'>) => Promise<boolean>;
|
|
332
|
+
enrollAccount?: (pairingId: string, proof: import('@agimon-ai/po-core').FederationEnvelope<'po/hub-enrollment/v1'>) => Promise<import('@agimon-ai/po-core').FederationEnvelope<'po/hub-enrollment/v1'> | undefined>;
|
|
333
|
+
/** Which listener a request arrived on, so control-plane routes can stay local. */
|
|
334
|
+
listenerOf: (context: Context) => GuardListener;
|
|
335
|
+
}
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region src/services/publicFileShares/index.d.ts
|
|
338
|
+
interface PublicFileShareRequest {
|
|
339
|
+
sessionId: string;
|
|
340
|
+
cwd: string;
|
|
341
|
+
/** Relative to cwd, or absolute. */
|
|
342
|
+
path: string;
|
|
343
|
+
/** Who the file is for, for the host's notice. */
|
|
344
|
+
label: string;
|
|
345
|
+
}
|
|
346
|
+
interface PublicFileShares {
|
|
347
|
+
mint(request: PublicFileShareRequest): Promise<PoSharedFile>;
|
|
348
|
+
mintRegistered(sessionId: string, file: PoRegisteredFile): Promise<PoSharedFile>;
|
|
349
|
+
serve(token: string, method: string): Promise<Response>;
|
|
350
|
+
}
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/services/remoteRuntime/index.d.ts
|
|
353
|
+
/** Only public exposure intent is durable. Credentials and pairing state never belong here. */
|
|
354
|
+
interface TunnelIntent {
|
|
355
|
+
hostname: string;
|
|
356
|
+
closesAt?: number;
|
|
357
|
+
}
|
|
358
|
+
interface RemoteRuntimeOptions {
|
|
359
|
+
homeDirectory: string;
|
|
360
|
+
registrationToken: string;
|
|
361
|
+
bundleTrust(): {
|
|
362
|
+
publicKey: string;
|
|
363
|
+
revision: number;
|
|
364
|
+
} | undefined;
|
|
365
|
+
/** Signs `po/host-channel-key/v1` fields with the shell signer, for native device reconnects. */
|
|
366
|
+
attestHost?: (fields: readonly string[]) => string | undefined;
|
|
367
|
+
onNotice(message: string): void;
|
|
368
|
+
/** The cohosted issuer resolves a one-use identity proof, never an account signing key. */
|
|
369
|
+
pairingAccount?: RemoteRoutesOptions['pairingAccount'];
|
|
370
|
+
/** Auth-owned public routes only, when this issuer is the tunnel origin. Never uses the host-token forwarder. */
|
|
371
|
+
publicAuth?: {
|
|
372
|
+
issuer(): string | undefined;
|
|
373
|
+
fetch(request: Request): Promise<Response>;
|
|
374
|
+
};
|
|
375
|
+
/** The listener to which a sealed, authenticated request is forwarded. */
|
|
376
|
+
forward(request: Request): Promise<Response>;
|
|
377
|
+
/** Destination verifier, composed with the hub's local pins and current issuer feed. */
|
|
378
|
+
federation?: {
|
|
379
|
+
verify(request: Request): Promise<PoFederationCaller | undefined>;
|
|
380
|
+
/** What a paired device is on this host. Absent stamps nothing, as on a personal host. */
|
|
381
|
+
callerAccess?(deviceId: string, verified?: PoFederationCaller): CallerAccess;
|
|
382
|
+
/** The team this host admits right now. */
|
|
383
|
+
team?(): import('@agimon-ai/po-core/headlessServer').HostTeam | 'loading' | undefined;
|
|
384
|
+
federationHost?: () => {
|
|
385
|
+
hostId: string;
|
|
386
|
+
hostPublicKey: string;
|
|
387
|
+
enrollmentGeneration?: number;
|
|
388
|
+
} | undefined;
|
|
389
|
+
enrollAccount?: RemoteRoutesOptions['enrollAccount'];
|
|
390
|
+
claimAccount?: RemoteRoutesOptions['claimAccount'];
|
|
391
|
+
unlinkAccount?: RemoteRoutesOptions['unlinkAccount'];
|
|
392
|
+
bindAccountDevice?: RemoteRoutesOptions['bindAccountDevice'];
|
|
393
|
+
};
|
|
394
|
+
federationPlatform?: HubFederationPlatform;
|
|
395
|
+
/** Hands a paired device's relayed Chord link to the protocol host, as an upgrade at `pathname` would. */
|
|
396
|
+
acceptProtocol(pathname: string, link: ProtocolLink, deviceId: string, client?: PoClientMetadata,
|
|
397
|
+
/** Set on a team host: who the device's person is there. Absent on a personal host. */
|
|
398
|
+
access?: Exclude<CallerAccess, 'refused' | undefined>): boolean;
|
|
399
|
+
onDeviceDropped?: (deviceId: string) => void;
|
|
400
|
+
onStateChanged?: () => void;
|
|
401
|
+
onTunnelIntentChanged?: (intent: TunnelIntent | undefined) => void;
|
|
402
|
+
launchTunnel?: TunnelLauncher;
|
|
403
|
+
/** Ports the host itself listens on, which a dev proxy target may never name. */
|
|
404
|
+
reservedPorts?: () => readonly (number | undefined)[];
|
|
405
|
+
/** Records slow, large or failing sealed HTTP exchanges, to attribute heap and event-loop cost. */
|
|
406
|
+
telemetry?: ServerTelemetry;
|
|
407
|
+
/** Keeps a line in the host's audit log when the gateway itself refuses a device its team cannot name. */
|
|
408
|
+
audit?: (entry: import('@agimon-ai/po-core/serverPlugin').PoAuditEntry) => void;
|
|
409
|
+
}
|
|
410
|
+
interface RemoteRuntime {
|
|
411
|
+
readonly federationClient?: import('@agimon-ai/po-core').PoFederationClient;
|
|
412
|
+
/** The team this host admits right now: undefined on a personal host, `loading` until it has been read once. */
|
|
413
|
+
team(): import('@agimon-ai/po-core/headlessServer').HostTeam | 'loading' | undefined;
|
|
414
|
+
/** What a paired device is on this host: undefined on a personal host, `refused` when a team host cannot name it. */
|
|
415
|
+
callerAccess(deviceId: string): CallerAccess;
|
|
416
|
+
readonly remote: RemoteAccess;
|
|
417
|
+
/** Short-lived public links served by the tunnel listener itself, never forwarded to the hub. */
|
|
418
|
+
readonly fileShares: PublicFileShares;
|
|
419
|
+
fetchLocal(request: Request): Promise<Response>;
|
|
420
|
+
requestNetwork?(request: Request): Promise<Response | undefined>;
|
|
421
|
+
networkComposition?(): Promise<{
|
|
422
|
+
network?: {
|
|
423
|
+
hostId: string;
|
|
424
|
+
networkId: string;
|
|
425
|
+
enrollmentGeneration?: number;
|
|
426
|
+
team?: string;
|
|
427
|
+
};
|
|
428
|
+
}>;
|
|
429
|
+
workspaceProviders?(workspaceId: string): Promise<{
|
|
430
|
+
providers?: import('@agimon-ai/po-core').FederationProvider[];
|
|
431
|
+
}>;
|
|
432
|
+
startNetwork?(): Promise<void>;
|
|
433
|
+
networkPeer?(): Promise<unknown>;
|
|
434
|
+
hostRequests?(): Promise<Omit<import('@agimon-ai/po-core/modelGateway').HostRequests, 'machineName'> | undefined>;
|
|
435
|
+
/** One signed call to the account's cloud host, such as the shared vault; `undefined` when not enrolled. */
|
|
436
|
+
accountCall?(operation: string, input: unknown): Promise<unknown>;
|
|
437
|
+
acceptNetworkRelay?(socket: import('@agimon-ai/po-core/packageApi').PoApiSocket, url: URL): Promise<void>;
|
|
438
|
+
/** Automatically restores only a valid, unchanged named hostname and unexpired deadline. */
|
|
439
|
+
restoreTunnel(intent: TunnelIntent): Promise<{
|
|
440
|
+
ok: true;
|
|
441
|
+
} | {
|
|
442
|
+
ok: false;
|
|
443
|
+
error: string;
|
|
444
|
+
}>;
|
|
445
|
+
tunnelIntent(): TunnelIntent | undefined;
|
|
446
|
+
close(): Promise<void>;
|
|
447
|
+
}
|
|
448
|
+
/** One global control plane and a second socket dedicated to public tunnel traffic. */
|
|
449
|
+
export declare function createRemoteRuntime(options: RemoteRuntimeOptions): RemoteRuntime;
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region src/services/remoteApi/index.d.ts
|
|
452
|
+
/** Global package mount for the machine's Remote Control service. */
|
|
453
|
+
export declare function createRemoteApi(control: PoRemoteGateway): PoApi;
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/services/devProxySocket/index.d.ts
|
|
456
|
+
interface DevProxySocketInput {
|
|
457
|
+
port: number;
|
|
458
|
+
/** Full upstream WebSocket URL; when set, `port` and `upstreamPath` only label notices. */
|
|
459
|
+
target?: string;
|
|
460
|
+
/** Extra handshake headers for the upstream, such as a forwarded credential. */
|
|
461
|
+
headers?: Record<string, string>;
|
|
462
|
+
/**
|
|
463
|
+
* Close code sent to the browser when the upstream drops without a sendable code or fails.
|
|
464
|
+
* A supervised upstream passes 1012 (service restart) so the browser reconnects.
|
|
465
|
+
*/
|
|
466
|
+
upstreamLostCode?: number;
|
|
467
|
+
/** Called once with the code sent to the browser when the relay closes. */
|
|
468
|
+
onClose?: (code: number) => void;
|
|
469
|
+
/** Path and query exactly as the browser sent them, prefix included. */
|
|
470
|
+
upstreamPath: string;
|
|
471
|
+
/** The browser's requested subprotocols, forwarded so HMR can negotiate. */
|
|
472
|
+
protocols: string | undefined;
|
|
473
|
+
onNotice?: (message: string) => void;
|
|
474
|
+
}
|
|
475
|
+
/** Relays one accepted browser socket to the dev server on the target's port until either side closes. */
|
|
476
|
+
export declare function relayDevProxySocket(client: WebSocket, input: DevProxySocketInput): void;
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/services/hubFederation/index.d.ts
|
|
479
|
+
/** Default own-hub boundary, enabled only by a durable claim and pinned issuer. */
|
|
480
|
+
export declare function createDefaultHubFederation(ports: HubFederationPlatform & {
|
|
481
|
+
store: {
|
|
482
|
+
read(): HubTrustState;
|
|
483
|
+
save(state: HubTrustState): boolean | Promise<boolean>;
|
|
484
|
+
};
|
|
485
|
+
databaseFile: string;
|
|
486
|
+
now(): number;
|
|
487
|
+
/** Revoke account-bound reconnect registrations, never local files or sessions. */
|
|
488
|
+
removedEnrollment?(owner: import('@agimon-ai/po-core').FederationPrincipal, generation: number): Promise<void>;
|
|
489
|
+
}): {
|
|
490
|
+
team: () => HostTeam | 'loading' | undefined;
|
|
491
|
+
/** What a paired device is on this host, from the account it enrolled with or the proof its request carried. */
|
|
492
|
+
callerAccess(deviceId: string, verified?: import('@agimon-ai/po-web-security/deviceProof').FederationCaller): CallerAccess;
|
|
493
|
+
federationHost(): {
|
|
494
|
+
hostId: string;
|
|
495
|
+
hostPublicKey: string;
|
|
496
|
+
enrollmentGeneration: number;
|
|
497
|
+
} | undefined;
|
|
498
|
+
verify(request: Request): Promise<import("@agimon-ai/po-web-security/deviceProof").FederationCaller | undefined>;
|
|
499
|
+
enrollAccount(pairingId: string, proof: FederationEnvelope<'po/hub-enrollment/v1'>): Promise<FederationEnvelope<"po/hub-enrollment/v1"> | undefined>;
|
|
500
|
+
bindAccountDevice(pairingId: string, trustedDeviceId: string): Promise<boolean>;
|
|
501
|
+
acceptRemovalReceipt(input: unknown): Promise<boolean>;
|
|
502
|
+
unlinkAccount(sealedDeviceId: string): Promise<boolean>;
|
|
503
|
+
claimAccount(claim: FederationEnvelope<'po/hub-claim/v1'>): Promise<boolean>;
|
|
504
|
+
acceptNetworkRelay(socket: import('@agimon-ai/po-core/packageApi').PoApiSocket, url: URL): Promise<void>;
|
|
505
|
+
client: {
|
|
506
|
+
hostId: () => string | undefined;
|
|
507
|
+
owner: () => import("@agimon-ai/po-core").FederationPrincipal | undefined;
|
|
508
|
+
saveGrant: (workId: string, grant: FederationEnvelope<"po/grant/v1">) => Promise<void>;
|
|
509
|
+
fire: (workId: string, request: FederationFireRequest) => Promise<FederationFireOutcome>;
|
|
510
|
+
calendarAuthorities: () => Promise<{
|
|
511
|
+
workId: string;
|
|
512
|
+
workspaceId: string;
|
|
513
|
+
securityScope: string;
|
|
514
|
+
setupDigest: string;
|
|
515
|
+
}[]>;
|
|
516
|
+
calendarCall: (request: {
|
|
517
|
+
workspaceId: string;
|
|
518
|
+
method: string;
|
|
519
|
+
owner: unknown;
|
|
520
|
+
args: unknown[];
|
|
521
|
+
actionChecked?: boolean;
|
|
522
|
+
}, workId: string) => Promise<unknown>;
|
|
523
|
+
calendarWorker: (request: {
|
|
524
|
+
operation: 'receive' | 'start' | 'settle' | 'reconcile';
|
|
525
|
+
input: unknown;
|
|
526
|
+
}, workId: string) => Promise<unknown>;
|
|
527
|
+
};
|
|
528
|
+
hostRequests(): Promise<Omit<import('@agimon-ai/po-core/modelGateway').HostRequests, 'machineName'>>;
|
|
529
|
+
networkPeer(): Promise<unknown>;
|
|
530
|
+
/** One signed call to the account's cloud host; `undefined` while this hub is not enrolled in a network. */
|
|
531
|
+
accountCall(operation: string, input: unknown): Promise<unknown>;
|
|
532
|
+
startNetwork(): Promise<void>;
|
|
533
|
+
networkComposition(): Promise<{
|
|
534
|
+
network?: undefined;
|
|
535
|
+
} | {
|
|
536
|
+
network: {
|
|
537
|
+
hostId: string;
|
|
538
|
+
networkId: string;
|
|
539
|
+
enrollmentGeneration: number;
|
|
540
|
+
team?: string | undefined;
|
|
541
|
+
};
|
|
542
|
+
}>;
|
|
543
|
+
workspaceProviders(workspaceId: string): Promise<{
|
|
544
|
+
providers?: undefined;
|
|
545
|
+
} | {
|
|
546
|
+
providers: import("@agimon-ai/po-core").FederationProvider[];
|
|
547
|
+
}>;
|
|
548
|
+
requestNetwork(request: Request, paired?: CallerAccess): Promise<Response | undefined>;
|
|
549
|
+
close(): Promise<void>;
|
|
550
|
+
};
|
|
551
|
+
//#endregion
|
|
552
|
+
export type { DevProxySocketInput, RemoteRuntime, RemoteRuntimeOptions, TunnelIntent };
|
|
553
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["_$___remoteRoutes0.RemoteRoutesOptions"],"sources":["../src/types/remote.ts","../src/services/deviceSessions/index.ts","../src/services/deviceAuth/index.ts","../src/services/pairingFlow/index.ts","../src/services/webauthnPolicy/index.ts","../src/services/remoteGuardPolicy/index.ts","../src/services/webauthn/index.ts","../src/services/remoteAccess/index.ts","../src/services/remoteRoutes/index.ts","../src/services/publicFileShares/index.ts","../src/services/remoteRuntime/index.ts","../src/services/remoteApi/index.ts","../src/services/devProxySocket/index.ts","../src/services/hubFederation/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;KAOY;KAEA;EAAgB;;EAAsB;;EAAsB;EAAoB;;;;UCkB3E;;EAEf;;EAEA;EACA;EACA;;EAEA;;EAEA;;EAEA,OAA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