@agentlogin/mcp 0.0.0-stage → 0.2.0-beta.1

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.
@@ -0,0 +1,316 @@
1
+ import { type CookieJar, type SignInAtOptions, type SignInResult } from 'agentlogin';
2
+ import { z } from 'zod';
3
+ import { type Application, type Config, type Identity } from './config.js';
4
+ import { type Catalog } from './catalog.js';
5
+ export declare class ToolError extends Error {
6
+ readonly code: string;
7
+ constructor(code: string, message: string);
8
+ }
9
+ export interface LoginClient {
10
+ discover(): Promise<{
11
+ issuer: string;
12
+ }>;
13
+ signInAt(url: string, options: SignInAtOptions): Promise<SignInResult>;
14
+ fetch(url: string, init?: RequestInit): Promise<Response>;
15
+ }
16
+ declare const SessionBindingSchema: z.ZodObject<{
17
+ handle: z.ZodString;
18
+ issuer: z.ZodString;
19
+ sub: z.ZodString;
20
+ }, z.core.$strict>;
21
+ export type SessionBinding = z.infer<typeof SessionBindingSchema>;
22
+ export interface RuntimeOptions {
23
+ now?: () => number;
24
+ /** An embedding host may supply its own protected, durable store; records contain no login authority. */
25
+ intents?: {
26
+ get(identity: string, application: string): unknown;
27
+ set(identity: string, application: string, value: unknown): void;
28
+ };
29
+ clientFactory?: (identity: Identity, app: Application, jar: CookieJar) => LoginClient;
30
+ jarFactory?: (identityId: string, applicationId: string) => CookieJar;
31
+ catalogs?: Catalog[];
32
+ sessionBindings?: {
33
+ get(key: string): Promise<SessionBinding | undefined>;
34
+ set(key: string, value: SessionBinding | undefined): Promise<void>;
35
+ };
36
+ }
37
+ export declare function safeError(error: unknown): {
38
+ code: string;
39
+ message: string;
40
+ };
41
+ /** Bounded JSON only: callback pages, response headers and Location values are never returned to the model. */
42
+ export declare function readJson(response: Response, maxBytes?: number): Promise<unknown>;
43
+ export declare class LoginRuntime {
44
+ private readonly options;
45
+ readonly config: Config;
46
+ private readonly contexts;
47
+ private readonly resolvers;
48
+ private readonly jobs;
49
+ private readonly busy;
50
+ private readonly lastStarted;
51
+ private readonly catalogs;
52
+ private lastCall;
53
+ private callTokens;
54
+ private readonly now;
55
+ constructor(config: unknown, options?: RuntimeOptions);
56
+ rateLimit(): void;
57
+ inventory(): {
58
+ identities: {
59
+ id: string;
60
+ handle: string;
61
+ enrollmentAvailable: boolean;
62
+ }[];
63
+ applications: {
64
+ id: string;
65
+ name: string;
66
+ origin: string;
67
+ operations: {
68
+ name: string;
69
+ description: string;
70
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
71
+ inputFields: string[];
72
+ queryFields: string[];
73
+ }[];
74
+ }[];
75
+ sessionLocation: string;
76
+ browserSession: boolean;
77
+ };
78
+ catalog(kind?: 'provider' | 'application'): {
79
+ entries: ({
80
+ protocol: "agent-login" | "agentid";
81
+ effectiveStatus: string;
82
+ automaticTrust: boolean;
83
+ kind: "provider";
84
+ issuer: string;
85
+ handleDomains: string[];
86
+ specRevision: string;
87
+ evidence: {
88
+ revision: string;
89
+ kind: "domain_control" | "protocol_test" | "independent_interop" | "operational_review";
90
+ url: string;
91
+ observedAt: string;
92
+ expiresAt: string;
93
+ reviewer: string;
94
+ protocol?: "agent-login" | undefined;
95
+ }[];
96
+ id: string;
97
+ name: string;
98
+ operator: string;
99
+ homepage: string;
100
+ status: "candidate" | "reviewed" | "suspended";
101
+ updatedAt: string;
102
+ } | {
103
+ protocol: "agent-login" | "agentid";
104
+ effectiveStatus: string;
105
+ automaticTrust: boolean;
106
+ protocolReference: string;
107
+ evidence: {
108
+ protocol: "agentid";
109
+ reference: string;
110
+ kind: "domain_control" | "protocol_test" | "independent_interop" | "operational_review";
111
+ url: string;
112
+ observedAt: string;
113
+ expiresAt: string;
114
+ reviewer: string;
115
+ }[];
116
+ kind: "provider";
117
+ issuer: string;
118
+ handleDomains: string[];
119
+ id: string;
120
+ name: string;
121
+ operator: string;
122
+ homepage: string;
123
+ status: "candidate" | "reviewed" | "suspended";
124
+ updatedAt: string;
125
+ } | {
126
+ protocol: "agent-login" | "agentid";
127
+ effectiveStatus: string;
128
+ automaticTrust: boolean;
129
+ clientType: "open";
130
+ clientId: string;
131
+ kind: "application";
132
+ initiateLoginUri: string;
133
+ specRevision: string;
134
+ evidence: {
135
+ revision: string;
136
+ kind: "domain_control" | "protocol_test" | "independent_interop" | "operational_review";
137
+ url: string;
138
+ observedAt: string;
139
+ expiresAt: string;
140
+ reviewer: string;
141
+ protocol?: "agent-login" | undefined;
142
+ }[];
143
+ id: string;
144
+ name: string;
145
+ operator: string;
146
+ homepage: string;
147
+ status: "candidate" | "reviewed" | "suspended";
148
+ updatedAt: string;
149
+ } | {
150
+ protocol: "agent-login" | "agentid";
151
+ effectiveStatus: string;
152
+ automaticTrust: boolean;
153
+ clientType: "registered";
154
+ clientId: string;
155
+ issuer: string;
156
+ kind: "application";
157
+ initiateLoginUri: string;
158
+ specRevision: string;
159
+ evidence: {
160
+ revision: string;
161
+ kind: "domain_control" | "protocol_test" | "independent_interop" | "operational_review";
162
+ url: string;
163
+ observedAt: string;
164
+ expiresAt: string;
165
+ reviewer: string;
166
+ protocol?: "agent-login" | undefined;
167
+ }[];
168
+ id: string;
169
+ name: string;
170
+ operator: string;
171
+ homepage: string;
172
+ status: "candidate" | "reviewed" | "suspended";
173
+ updatedAt: string;
174
+ })[];
175
+ automaticTrust: boolean;
176
+ };
177
+ private key;
178
+ private configuredPair;
179
+ private context;
180
+ private binding;
181
+ private bind;
182
+ private intentFile;
183
+ private intentBinding;
184
+ private readIntent;
185
+ private saveIntent;
186
+ private restored;
187
+ private prune;
188
+ start(identity: string, application: string): {
189
+ pollAfterSeconds?: number | undefined;
190
+ sessionLocation: string;
191
+ browserSession: boolean;
192
+ ownerApprovalUrl?: string | undefined;
193
+ transactionId?: string | undefined;
194
+ ownerPortal?: string | undefined;
195
+ disclosure?: {
196
+ scope: string;
197
+ title: string;
198
+ description: string;
199
+ }[] | undefined;
200
+ client?: {
201
+ client_id: string;
202
+ client_type: string;
203
+ redirect_host: string;
204
+ client_name?: string;
205
+ logo_uri?: string;
206
+ tos_uri?: string;
207
+ policy_uri?: string;
208
+ } | undefined;
209
+ consentReason?: string | undefined;
210
+ disclosureIsUntrustedText?: boolean | undefined;
211
+ scopes?: string[] | undefined;
212
+ error?: string | undefined;
213
+ operation: string;
214
+ intent: string;
215
+ identity: string;
216
+ application: string;
217
+ status: "starting" | "awaiting_consent" | "awaiting_owner" | "completing" | "authenticated" | "failed" | "paused" | "expired";
218
+ expiresAt: number;
219
+ decisionExpiresAt: number;
220
+ resumable: boolean;
221
+ };
222
+ status(operation: string): {
223
+ pollAfterSeconds?: number | undefined;
224
+ sessionLocation: string;
225
+ browserSession: boolean;
226
+ ownerApprovalUrl?: string | undefined;
227
+ transactionId?: string | undefined;
228
+ ownerPortal?: string | undefined;
229
+ disclosure?: {
230
+ scope: string;
231
+ title: string;
232
+ description: string;
233
+ }[] | undefined;
234
+ client?: {
235
+ client_id: string;
236
+ client_type: string;
237
+ redirect_host: string;
238
+ client_name?: string;
239
+ logo_uri?: string;
240
+ tos_uri?: string;
241
+ policy_uri?: string;
242
+ } | undefined;
243
+ consentReason?: string | undefined;
244
+ disclosureIsUntrustedText?: boolean | undefined;
245
+ scopes?: string[] | undefined;
246
+ error?: string | undefined;
247
+ operation: string;
248
+ intent: string;
249
+ identity: string;
250
+ application: string;
251
+ status: "starting" | "awaiting_consent" | "awaiting_owner" | "completing" | "authenticated" | "failed" | "paused" | "expired";
252
+ expiresAt: number;
253
+ decisionExpiresAt: number;
254
+ resumable: boolean;
255
+ };
256
+ review(operation: string, decision: 'allow' | 'deny'): {
257
+ pollAfterSeconds?: number | undefined;
258
+ sessionLocation: string;
259
+ browserSession: boolean;
260
+ ownerApprovalUrl?: string | undefined;
261
+ transactionId?: string | undefined;
262
+ ownerPortal?: string | undefined;
263
+ disclosure?: {
264
+ scope: string;
265
+ title: string;
266
+ description: string;
267
+ }[] | undefined;
268
+ client?: {
269
+ client_id: string;
270
+ client_type: string;
271
+ redirect_host: string;
272
+ client_name?: string;
273
+ logo_uri?: string;
274
+ tos_uri?: string;
275
+ policy_uri?: string;
276
+ } | undefined;
277
+ consentReason?: string | undefined;
278
+ disclosureIsUntrustedText?: boolean | undefined;
279
+ scopes?: string[] | undefined;
280
+ error?: string | undefined;
281
+ operation: string;
282
+ intent: string;
283
+ identity: string;
284
+ application: string;
285
+ status: "starting" | "awaiting_consent" | "awaiting_owner" | "completing" | "authenticated" | "failed" | "paused" | "expired";
286
+ expiresAt: number;
287
+ decisionExpiresAt: number;
288
+ resumable: boolean;
289
+ };
290
+ private complete;
291
+ private awaitReview;
292
+ private checkSession;
293
+ request(identity: string, application: string, operation: string, input?: Record<string, unknown>): Promise<{
294
+ status: number;
295
+ succeeded: boolean;
296
+ retryAutomatically: boolean;
297
+ data?: undefined;
298
+ dataIsUntrusted?: undefined;
299
+ } | {
300
+ status: number;
301
+ succeeded: boolean;
302
+ data: Record<string, unknown>;
303
+ dataIsUntrusted: boolean;
304
+ retryAutomatically?: undefined;
305
+ }>;
306
+ logout(identity: string, application: string): Promise<{
307
+ loggedOut: boolean;
308
+ application: string;
309
+ identity: string;
310
+ browserSession: boolean;
311
+ }>;
312
+ private exclusive;
313
+ /** Useful to an embedding host during graceful shutdown and to deterministic integration tests. */
314
+ settled(operation: string): Promise<ReturnType<LoginRuntime['status']>>;
315
+ }
316
+ export {};