@alfe.ai/microsoft-mcp 0.1.6 → 0.1.8
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/README.md +24 -1
- package/dist/server.cjs +538 -0
- package/dist/server.d.cts +1935 -0
- package/dist/server.d.ts +1913 -32
- package/dist/server.js +457 -225
- package/package.json +6 -4
|
@@ -0,0 +1,1935 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ChangelogEntry, EncryptedEnvelopeV1, FieldEnvelope, FieldFormat, FieldSensitivity, GeneratedDataKey, IntegrationConfigResult, IntegrationInstall, RegistryEntry, ScopeInfo, SecretAggregate, SecretCategory, SecretMetadata, SecretScope } from "@alfe/types";
|
|
3
|
+
|
|
4
|
+
//#region ../agent-api-client/dist/index.d.ts
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=tool-error-capture.d.ts.map
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/transport.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Shared HTTP transport for the Agent API client — request core, retry
|
|
11
|
+
* policy, error formatting, and the `ApiBase` class the domain method
|
|
12
|
+
* groups under `./domains/` build on.
|
|
13
|
+
*/
|
|
14
|
+
interface AgentApiClientConfig {
|
|
15
|
+
apiKey: string;
|
|
16
|
+
apiUrl: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Encode each path segment but keep the `/` separators — `encodeURIComponent`
|
|
20
|
+
* would escape the slashes too, breaking greedy proxy routes.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
declare class AgentApiTransport {
|
|
24
|
+
private readonly apiKey;
|
|
25
|
+
private readonly apiUrl;
|
|
26
|
+
constructor(config: AgentApiClientConfig);
|
|
27
|
+
/**
|
|
28
|
+
* Binary sibling of `request<T>()`. `request()` forces
|
|
29
|
+
* `Content-Type: application/json` and parses a `{ data: T }` envelope,
|
|
30
|
+
* neither of which fits a raw-audio flow (voice TTS/STT), so those go
|
|
31
|
+
* through this instead. Auth (Bearer), the request budget, and the single
|
|
32
|
+
* retry policy on transient 5xx / network errors is kept in sync with
|
|
33
|
+
* `request()`. Safe read methods retry once by default; mutation methods do
|
|
34
|
+
* not, because a response can be lost after a handler or provider call has
|
|
35
|
+
* already succeeded.
|
|
36
|
+
*/
|
|
37
|
+
rawRequest(path: string, init: {
|
|
38
|
+
method: string;
|
|
39
|
+
headers: Headers;
|
|
40
|
+
body?: BodyInit | Uint8Array;
|
|
41
|
+
}, extra?: {
|
|
42
|
+
retry?: boolean;
|
|
43
|
+
}): Promise<Response>;
|
|
44
|
+
/**
|
|
45
|
+
* @param extra.timeoutMs Per-request abort timeout (default REQUEST_TIMEOUT_MS).
|
|
46
|
+
* Long endpoints (image generation) pass a larger value so the gateway's
|
|
47
|
+
* own timeout wins with a readable status instead of a client-side abort.
|
|
48
|
+
* @param extra.retry Whether to retry once on transient failures. Safe reads
|
|
49
|
+
* (GET/HEAD/OPTIONS) default to true; mutations default to false. Set true
|
|
50
|
+
* only when the endpoint's server-side contract is explicitly idempotent.
|
|
51
|
+
* @param extra.signal Optional caller cancellation combined with the client's
|
|
52
|
+
* own timeout budget. Aborting either signal cancels the request.
|
|
53
|
+
*/
|
|
54
|
+
request<T>(path: string, options?: RequestInit, extra?: {
|
|
55
|
+
timeoutMs?: number;
|
|
56
|
+
retry?: boolean;
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
}): Promise<T>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Base class for the domain method groups. Holds the shared transport;
|
|
62
|
+
* `AgentApiClient` assembles the groups onto one class via `applyMixins`
|
|
63
|
+
* (prototype copy), so methods keep their original `this`-on-the-client
|
|
64
|
+
* call shape.
|
|
65
|
+
*/
|
|
66
|
+
declare class ApiBase {
|
|
67
|
+
protected readonly transport: AgentApiTransport;
|
|
68
|
+
constructor(transport: AgentApiTransport);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/domains/workspace.d.ts
|
|
73
|
+
/** Response of GET /agent/workspace (services/agents). */
|
|
74
|
+
interface AgentWorkspaceInfo {
|
|
75
|
+
templateKey?: string;
|
|
76
|
+
defaultModel?: string;
|
|
77
|
+
installedFrom?: {
|
|
78
|
+
templateKey: string;
|
|
79
|
+
authorTenantId: string;
|
|
80
|
+
version: number;
|
|
81
|
+
};
|
|
82
|
+
runtime?: string;
|
|
83
|
+
teams?: {
|
|
84
|
+
teamId: string;
|
|
85
|
+
name: string;
|
|
86
|
+
description?: string;
|
|
87
|
+
parentTeamId?: string;
|
|
88
|
+
}[];
|
|
89
|
+
projects?: {
|
|
90
|
+
projectId: string;
|
|
91
|
+
name: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
status: string;
|
|
94
|
+
parentProjectId?: string;
|
|
95
|
+
}[];
|
|
96
|
+
teamIds?: string[];
|
|
97
|
+
projectIds?: string[];
|
|
98
|
+
}
|
|
99
|
+
declare class WorkspaceApi extends ApiBase {
|
|
100
|
+
/**
|
|
101
|
+
* GET /agent/workspace — workspace config for the authenticated agent
|
|
102
|
+
* (template assignment, default model, org roster).
|
|
103
|
+
*/
|
|
104
|
+
getWorkspace(): Promise<AgentWorkspaceInfo>;
|
|
105
|
+
/**
|
|
106
|
+
* GET /templates/{key}/files — persona/workspace file contents for a
|
|
107
|
+
* template the agent has access to. Pass `version` to pin to the version
|
|
108
|
+
* the agent was installed from (omit → the endpoint resolves `latest`).
|
|
109
|
+
*/
|
|
110
|
+
getTemplateFiles(templateKey: string, opts?: {
|
|
111
|
+
version?: number;
|
|
112
|
+
}): Promise<{
|
|
113
|
+
files: Record<string, string>;
|
|
114
|
+
}>;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/domains/sync.d.ts
|
|
119
|
+
interface SyncAgentInfo {
|
|
120
|
+
agentId: string;
|
|
121
|
+
tenantId: string;
|
|
122
|
+
displayName: string;
|
|
123
|
+
s3Prefix: string;
|
|
124
|
+
status: "stale" | "syncing" | "synced";
|
|
125
|
+
fileCount?: number;
|
|
126
|
+
totalSize?: number;
|
|
127
|
+
lastSync?: string;
|
|
128
|
+
}
|
|
129
|
+
interface SyncManifestEntry {
|
|
130
|
+
hash: string;
|
|
131
|
+
size: number;
|
|
132
|
+
modified: string;
|
|
133
|
+
etag?: string;
|
|
134
|
+
storageClass?: string;
|
|
135
|
+
compressed?: boolean;
|
|
136
|
+
}
|
|
137
|
+
interface SyncManifest {
|
|
138
|
+
version: 1;
|
|
139
|
+
agentId: string;
|
|
140
|
+
lastSync: string;
|
|
141
|
+
files: Record<string, SyncManifestEntry>;
|
|
142
|
+
}
|
|
143
|
+
interface SyncPresignedUrl {
|
|
144
|
+
path: string;
|
|
145
|
+
url: string;
|
|
146
|
+
expiresAt: string;
|
|
147
|
+
}
|
|
148
|
+
interface SyncConfirmedUpload {
|
|
149
|
+
filePath: string;
|
|
150
|
+
hash: string;
|
|
151
|
+
size: number;
|
|
152
|
+
storageClass: "STANDARD" | "GLACIER_IR";
|
|
153
|
+
syncedAt: string;
|
|
154
|
+
}
|
|
155
|
+
interface SyncReconstructFile {
|
|
156
|
+
path: string;
|
|
157
|
+
size: number;
|
|
158
|
+
url: string;
|
|
159
|
+
storageClass?: string;
|
|
160
|
+
compressed?: boolean;
|
|
161
|
+
}
|
|
162
|
+
interface SyncReconstructBundle {
|
|
163
|
+
agentId: string;
|
|
164
|
+
mode: "full" | "active" | "memory";
|
|
165
|
+
fileCount: number;
|
|
166
|
+
totalSize: number;
|
|
167
|
+
files: SyncReconstructFile[];
|
|
168
|
+
expiresAt: string;
|
|
169
|
+
}
|
|
170
|
+
interface SyncAgentStats {
|
|
171
|
+
agentId: string;
|
|
172
|
+
standardBytes: number;
|
|
173
|
+
glacierBytes: number;
|
|
174
|
+
fileCount: number;
|
|
175
|
+
lastSyncAt: string | null;
|
|
176
|
+
}
|
|
177
|
+
interface SyncFileEntry {
|
|
178
|
+
filePath: string;
|
|
179
|
+
size: number;
|
|
180
|
+
modified: string;
|
|
181
|
+
contentHash: string;
|
|
182
|
+
storageClass?: string;
|
|
183
|
+
compressed?: boolean;
|
|
184
|
+
}
|
|
185
|
+
interface SyncSessionEntry {
|
|
186
|
+
sessionId: string;
|
|
187
|
+
size: number;
|
|
188
|
+
lastModified: string;
|
|
189
|
+
storageClass?: string;
|
|
190
|
+
isArchived: boolean;
|
|
191
|
+
}
|
|
192
|
+
interface SyncSessionContent {
|
|
193
|
+
sessionId: string;
|
|
194
|
+
content: string;
|
|
195
|
+
compressed: boolean;
|
|
196
|
+
}
|
|
197
|
+
interface SharedFileEntry {
|
|
198
|
+
filePath: string;
|
|
199
|
+
fileName: string;
|
|
200
|
+
size: number;
|
|
201
|
+
contentType?: string;
|
|
202
|
+
}
|
|
203
|
+
declare class SyncApi extends ApiBase {
|
|
204
|
+
syncRegister(args?: {
|
|
205
|
+
displayName?: string;
|
|
206
|
+
}): Promise<{
|
|
207
|
+
agent: SyncAgentInfo;
|
|
208
|
+
}>;
|
|
209
|
+
syncGetManifest(): Promise<SyncManifest>;
|
|
210
|
+
syncPresign(args: {
|
|
211
|
+
files: {
|
|
212
|
+
path: string;
|
|
213
|
+
operation: "put" | "get";
|
|
214
|
+
contentType?: string;
|
|
215
|
+
}[];
|
|
216
|
+
}): Promise<{
|
|
217
|
+
urls: SyncPresignedUrl[];
|
|
218
|
+
}>;
|
|
219
|
+
syncConfirmUpload(args: {
|
|
220
|
+
filePath: string;
|
|
221
|
+
hash: string;
|
|
222
|
+
size: number;
|
|
223
|
+
storageClass?: "STANDARD" | "GLACIER_IR";
|
|
224
|
+
}): Promise<SyncConfirmedUpload>;
|
|
225
|
+
syncReconstruct(args: {
|
|
226
|
+
mode: "full" | "active" | "memory";
|
|
227
|
+
}): Promise<SyncReconstructBundle>;
|
|
228
|
+
syncGetStats(): Promise<SyncAgentStats>;
|
|
229
|
+
syncListFiles(args?: {
|
|
230
|
+
prefix?: string;
|
|
231
|
+
}): Promise<{
|
|
232
|
+
files: SyncFileEntry[];
|
|
233
|
+
}>;
|
|
234
|
+
syncListSessions(): Promise<{
|
|
235
|
+
sessions: SyncSessionEntry[];
|
|
236
|
+
}>;
|
|
237
|
+
syncGetSession(sessionId: string): Promise<SyncSessionContent>;
|
|
238
|
+
syncDeleteFile(filePath: string): Promise<{
|
|
239
|
+
removed: boolean;
|
|
240
|
+
}>;
|
|
241
|
+
sharedListFiles(args: {
|
|
242
|
+
scope: "org" | "team" | "project";
|
|
243
|
+
scopeId: string;
|
|
244
|
+
limit?: number;
|
|
245
|
+
cursor?: string;
|
|
246
|
+
}): Promise<{
|
|
247
|
+
files: SharedFileEntry[];
|
|
248
|
+
nextCursor: string | null;
|
|
249
|
+
}>;
|
|
250
|
+
sharedDownloadUrl(args: {
|
|
251
|
+
scope: "org" | "team" | "project";
|
|
252
|
+
scopeId: string;
|
|
253
|
+
filePath: string;
|
|
254
|
+
}): Promise<{
|
|
255
|
+
downloadUrl: string;
|
|
256
|
+
expiresIn: number;
|
|
257
|
+
}>;
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/domains/knowledge.d.ts
|
|
262
|
+
type KnowledgeScopeType = "org" | "team" | "project";
|
|
263
|
+
interface KnowledgeScope {
|
|
264
|
+
scopeType: KnowledgeScopeType;
|
|
265
|
+
scopeId: string;
|
|
266
|
+
name: string;
|
|
267
|
+
}
|
|
268
|
+
interface KnowledgeSearchHit {
|
|
269
|
+
id: string;
|
|
270
|
+
text: string;
|
|
271
|
+
/** Normalized relevance in (0,1]; higher = closer. */
|
|
272
|
+
score: number;
|
|
273
|
+
scopeType: KnowledgeScopeType;
|
|
274
|
+
scopeId: string;
|
|
275
|
+
/**
|
|
276
|
+
* Provenance of the hit. All live results are `"doc"`; `"fact"` only ever
|
|
277
|
+
* appears for legacy vectors indexed before the facts primitive was removed
|
|
278
|
+
* (the search index stays tolerant of them). Treat every hit as a doc.
|
|
279
|
+
*/
|
|
280
|
+
source: "doc" | "fact";
|
|
281
|
+
/** The canonical file under shared/<scope>/ (present on doc hits). */
|
|
282
|
+
filePath?: string;
|
|
283
|
+
/** Legacy-only: the id of a pre-removal fact vector. */
|
|
284
|
+
factId?: string;
|
|
285
|
+
}
|
|
286
|
+
interface KnowledgeSearchResult {
|
|
287
|
+
results: KnowledgeSearchHit[];
|
|
288
|
+
/** True when fan-out breadth was capped (more member scopes than the cap). */
|
|
289
|
+
truncatedScopes: boolean;
|
|
290
|
+
}
|
|
291
|
+
interface KnowledgeProfileLink {
|
|
292
|
+
label: string;
|
|
293
|
+
url: string;
|
|
294
|
+
}
|
|
295
|
+
interface KnowledgeProfile {
|
|
296
|
+
scopeType: KnowledgeScopeType;
|
|
297
|
+
scopeId: string;
|
|
298
|
+
about: string | null;
|
|
299
|
+
description: string | null;
|
|
300
|
+
links: KnowledgeProfileLink[];
|
|
301
|
+
updatedAt: string | null;
|
|
302
|
+
updatedBy: string | null;
|
|
303
|
+
}
|
|
304
|
+
type ChangeRequestResourceType = "doc" | "profile";
|
|
305
|
+
type ChangeRequestOperation = "create" | "update" | "delete";
|
|
306
|
+
type ChangeRequestStatus = "open" | "approved" | "rejected" | "withdrawn" | "superseded";
|
|
307
|
+
type ChangeRequestActorKind = "human" | "agent";
|
|
308
|
+
/** Public projection of a change request (mirrors `PublicChangeRequest` in services/org). */
|
|
309
|
+
interface KnowledgeChangeRequest {
|
|
310
|
+
changeRequestId: string;
|
|
311
|
+
scopeType: KnowledgeScopeType;
|
|
312
|
+
scopeId: string;
|
|
313
|
+
resourceType: ChangeRequestResourceType;
|
|
314
|
+
operation: ChangeRequestOperation;
|
|
315
|
+
targetPath: string | null;
|
|
316
|
+
baseVersionId: string | null;
|
|
317
|
+
proposedContentType: string | null;
|
|
318
|
+
status: ChangeRequestStatus;
|
|
319
|
+
proposerId: string;
|
|
320
|
+
proposerKind: ChangeRequestActorKind;
|
|
321
|
+
rationale: string;
|
|
322
|
+
reviewerId: string | null;
|
|
323
|
+
reviewerKind: ChangeRequestActorKind | null;
|
|
324
|
+
reviewedAt: string | null;
|
|
325
|
+
reviewNote: string | null;
|
|
326
|
+
appliedRef: string | null;
|
|
327
|
+
createdAt: string;
|
|
328
|
+
updatedAt: string;
|
|
329
|
+
}
|
|
330
|
+
/** Per-type proposal payload for `proposeScopeChange`. */
|
|
331
|
+
interface ProposeScopeChangeInput {
|
|
332
|
+
resourceType: ChangeRequestResourceType;
|
|
333
|
+
operation: ChangeRequestOperation;
|
|
334
|
+
/** Why the change is proposed — shown to the reviewer. */
|
|
335
|
+
rationale: string;
|
|
336
|
+
/** doc: the path the proposal applies to (e.g. designs/data-center.md). */
|
|
337
|
+
targetPath?: string;
|
|
338
|
+
/** doc create/update: the staged body to upload (markdown or other text). */
|
|
339
|
+
content?: string;
|
|
340
|
+
/** doc create/update: content type of the staged body (default text/markdown). */
|
|
341
|
+
contentType?: string;
|
|
342
|
+
/** profile: the proposed value ({ about, description, links }). */
|
|
343
|
+
proposedValue?: unknown;
|
|
344
|
+
}
|
|
345
|
+
interface KnowledgeDoc {
|
|
346
|
+
filePath: string;
|
|
347
|
+
fileName: string;
|
|
348
|
+
contentType?: string;
|
|
349
|
+
size: number;
|
|
350
|
+
uploadedBy?: string;
|
|
351
|
+
createdAt: string;
|
|
352
|
+
updatedAt: string;
|
|
353
|
+
}
|
|
354
|
+
declare class KnowledgeApi extends ApiBase {
|
|
355
|
+
/**
|
|
356
|
+
* Semantic search across the agent's member scopes. Fan-out is gated
|
|
357
|
+
* server-side by `listScopes` set-inclusion (fail-closed). Pass
|
|
358
|
+
* `scopeType` + `scopeId` to narrow to one scope; a non-member scope
|
|
359
|
+
* yields empty results (never a cross-scope leak).
|
|
360
|
+
*/
|
|
361
|
+
knowledgeSearch(query: string, opts?: {
|
|
362
|
+
limit?: number;
|
|
363
|
+
scopeType?: KnowledgeScopeType;
|
|
364
|
+
scopeId?: string;
|
|
365
|
+
}): Promise<KnowledgeSearchResult>;
|
|
366
|
+
/** Enumerate the scopes (org + teams + projects) this agent belongs to. */
|
|
367
|
+
listScopes(): Promise<{
|
|
368
|
+
scopes: KnowledgeScope[];
|
|
369
|
+
}>;
|
|
370
|
+
/** Read a scope's structured knowledge profile (after membership check). */
|
|
371
|
+
getScopeProfile(scopeType: KnowledgeScopeType, scopeId: string): Promise<KnowledgeProfile>;
|
|
372
|
+
/**
|
|
373
|
+
* Open a change request against a scope's knowledge resource. For a doc
|
|
374
|
+
* create/update, `services/org` returns a presigned staging PUT; this method
|
|
375
|
+
* uploads the proposed `content` to it (echoing the same Content-Type that
|
|
376
|
+
* was signed), mirroring `writeScopeDoc`. The staged body is applied to the
|
|
377
|
+
* canonical doc — attributed to this agent — only when a reviewer approves.
|
|
378
|
+
*/
|
|
379
|
+
proposeScopeChange(scopeType: KnowledgeScopeType, scopeId: string, input: ProposeScopeChangeInput): Promise<KnowledgeChangeRequest>;
|
|
380
|
+
/**
|
|
381
|
+
* List the agent's OWN change requests in a scope (filtered server-side to
|
|
382
|
+
* this agent as proposer). Pass `status` to narrow to open / approved / etc.
|
|
383
|
+
*/
|
|
384
|
+
listScopeChangeRequests(scopeType: KnowledgeScopeType, scopeId: string, opts?: {
|
|
385
|
+
status?: ChangeRequestStatus;
|
|
386
|
+
limit?: number;
|
|
387
|
+
cursor?: string;
|
|
388
|
+
}): Promise<{
|
|
389
|
+
changeRequests: KnowledgeChangeRequest[];
|
|
390
|
+
nextCursor: string | null;
|
|
391
|
+
}>;
|
|
392
|
+
/** List a scope's docs (the org-files corpus; mirrored to shared/<scope>/). */
|
|
393
|
+
listScopeDocs(scopeType: KnowledgeScopeType, scopeId: string, opts?: {
|
|
394
|
+
limit?: number;
|
|
395
|
+
cursor?: string;
|
|
396
|
+
}): Promise<{
|
|
397
|
+
files: KnowledgeDoc[];
|
|
398
|
+
nextCursor: string | null;
|
|
399
|
+
}>;
|
|
400
|
+
/**
|
|
401
|
+
* Read the full text of a scope doc. Resolves a presigned download URL
|
|
402
|
+
* from `services/org`, then fetches the bytes directly from S3 (the one
|
|
403
|
+
* legitimate raw fetch in a plugin — same pattern as sync).
|
|
404
|
+
*/
|
|
405
|
+
readScopeDoc(scopeType: KnowledgeScopeType, scopeId: string, filePath: string, opts?: {
|
|
406
|
+
maxBytes?: number;
|
|
407
|
+
}): Promise<{
|
|
408
|
+
filePath: string;
|
|
409
|
+
text: string;
|
|
410
|
+
}>;
|
|
411
|
+
/**
|
|
412
|
+
* Write (create or overwrite) a scope doc. Two-step presigned upload:
|
|
413
|
+
* `services/org` returns a signed URL plus `requiredHeaders` (author /
|
|
414
|
+
* authorKind / message as `x-amz-meta-*`) that MUST be sent verbatim on
|
|
415
|
+
* the PUT, alongside the same `Content-Type` that was signed. Author and
|
|
416
|
+
* authorKind are server-set from the agent token — never trusted here.
|
|
417
|
+
*/
|
|
418
|
+
writeScopeDoc(scopeType: KnowledgeScopeType, scopeId: string, filePath: string, content: string, opts?: {
|
|
419
|
+
contentType?: string;
|
|
420
|
+
message?: string;
|
|
421
|
+
}): Promise<{
|
|
422
|
+
filePath: string;
|
|
423
|
+
}>;
|
|
424
|
+
}
|
|
425
|
+
//# sourceMappingURL=knowledge.d.ts.map
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/domains/mobile.d.ts
|
|
428
|
+
/** Response of GET /mobile/numbers for an agent (services/mobile). */
|
|
429
|
+
interface MobileNumberInfo {
|
|
430
|
+
phoneNumber: string;
|
|
431
|
+
countryCode: string;
|
|
432
|
+
monthlyPrice?: number;
|
|
433
|
+
status: string;
|
|
434
|
+
errorMessage?: string;
|
|
435
|
+
}
|
|
436
|
+
/** One purchasable number from GET /mobile/numbers/search. */
|
|
437
|
+
interface MobileAvailableNumber {
|
|
438
|
+
number: string;
|
|
439
|
+
friendlyName: string;
|
|
440
|
+
locality: string;
|
|
441
|
+
region: string;
|
|
442
|
+
country: string;
|
|
443
|
+
}
|
|
444
|
+
/** Approved WhatsApp content template from GET /mobile/whatsapp/templates. */
|
|
445
|
+
interface WhatsAppTemplate {
|
|
446
|
+
contentSid: string;
|
|
447
|
+
name: string;
|
|
448
|
+
language: string;
|
|
449
|
+
body: string;
|
|
450
|
+
variables: Record<string, string>;
|
|
451
|
+
category?: string;
|
|
452
|
+
}
|
|
453
|
+
declare class MobileApi extends ApiBase {
|
|
454
|
+
getMobileNumber(): Promise<MobileNumberInfo>;
|
|
455
|
+
searchMobileNumbers(args?: {
|
|
456
|
+
country?: string;
|
|
457
|
+
query?: string;
|
|
458
|
+
}): Promise<{
|
|
459
|
+
numbers: MobileAvailableNumber[];
|
|
460
|
+
monthlyPrice: number;
|
|
461
|
+
}>;
|
|
462
|
+
assignMobileNumber(args: {
|
|
463
|
+
phoneNumber: string;
|
|
464
|
+
countryCode: string;
|
|
465
|
+
}): Promise<{
|
|
466
|
+
phoneNumber: string;
|
|
467
|
+
countryCode: string;
|
|
468
|
+
status: "pending";
|
|
469
|
+
}>;
|
|
470
|
+
releaseMobileNumber(): Promise<{
|
|
471
|
+
released: true;
|
|
472
|
+
}>;
|
|
473
|
+
sendSms(args: {
|
|
474
|
+
to: string;
|
|
475
|
+
body: string;
|
|
476
|
+
}): Promise<{
|
|
477
|
+
sent: true;
|
|
478
|
+
sid: string;
|
|
479
|
+
}>;
|
|
480
|
+
startOutboundCall(args: {
|
|
481
|
+
to: string;
|
|
482
|
+
}): Promise<{
|
|
483
|
+
callSid: string;
|
|
484
|
+
status: string;
|
|
485
|
+
}>;
|
|
486
|
+
getWhatsAppSession(to: string): Promise<{
|
|
487
|
+
active: boolean;
|
|
488
|
+
expiresAt?: string;
|
|
489
|
+
}>;
|
|
490
|
+
sendWhatsAppMessage(args: {
|
|
491
|
+
to: string;
|
|
492
|
+
body: string;
|
|
493
|
+
}): Promise<{
|
|
494
|
+
sent: true;
|
|
495
|
+
sid: string;
|
|
496
|
+
}>;
|
|
497
|
+
sendWhatsAppTemplate(args: {
|
|
498
|
+
to: string;
|
|
499
|
+
contentSid: string;
|
|
500
|
+
contentVariables: Record<string, string>;
|
|
501
|
+
bodyPreview?: string;
|
|
502
|
+
}): Promise<{
|
|
503
|
+
sent: true;
|
|
504
|
+
sid: string;
|
|
505
|
+
}>;
|
|
506
|
+
listWhatsAppTemplates(): Promise<{
|
|
507
|
+
templates: WhatsAppTemplate[];
|
|
508
|
+
}>;
|
|
509
|
+
}
|
|
510
|
+
//# sourceMappingURL=mobile.d.ts.map
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/domains/remote.d.ts
|
|
513
|
+
interface RemoteSessionInfo {
|
|
514
|
+
sessionId: string;
|
|
515
|
+
agentId: string;
|
|
516
|
+
surface: "browser" | "terminal";
|
|
517
|
+
status: "agent_driving" | "awaiting_human" | "human_in_control" | "resuming" | "completed" | "expired" | "failed";
|
|
518
|
+
url?: string;
|
|
519
|
+
instructions?: string;
|
|
520
|
+
requestedAt?: string;
|
|
521
|
+
}
|
|
522
|
+
declare class RemoteApi extends ApiBase {
|
|
523
|
+
requestBrowserTakeover(args: {
|
|
524
|
+
instructions: string;
|
|
525
|
+
url?: string;
|
|
526
|
+
conversationId?: string;
|
|
527
|
+
}): Promise<{
|
|
528
|
+
sessionId: string;
|
|
529
|
+
status: string;
|
|
530
|
+
}>;
|
|
531
|
+
getRemoteSession(sessionId: string): Promise<RemoteSessionInfo>;
|
|
532
|
+
completeRemoteSession(sessionId: string): Promise<{
|
|
533
|
+
ok: boolean;
|
|
534
|
+
}>;
|
|
535
|
+
}
|
|
536
|
+
//# sourceMappingURL=remote.d.ts.map
|
|
537
|
+
//#endregion
|
|
538
|
+
//#region src/domains/self.d.ts
|
|
539
|
+
/** Voice settings — core agent config. Mirrors `VoiceConfig` in `@alfe/types`. */
|
|
540
|
+
interface AgentVoiceConfig {
|
|
541
|
+
/** ElevenLabs voice ID; platform default when unset. */
|
|
542
|
+
voiceId?: string;
|
|
543
|
+
ttsModel?: string;
|
|
544
|
+
enabled?: boolean;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* The agent's own public identity, as returned by `updateSelf`, `generateAvatar`,
|
|
548
|
+
* `presignAvatar`'s finalize (`finalizeAvatar`). This is the public agent
|
|
549
|
+
* projection; only the identity-relevant fields are typed here — the response
|
|
550
|
+
* carries the full public agent record.
|
|
551
|
+
*/
|
|
552
|
+
interface AgentSelf {
|
|
553
|
+
agentId: string;
|
|
554
|
+
tenantId: string;
|
|
555
|
+
name: string;
|
|
556
|
+
avatarUrl?: string;
|
|
557
|
+
voiceConfig?: AgentVoiceConfig;
|
|
558
|
+
status: string;
|
|
559
|
+
}
|
|
560
|
+
/** Result of `presignAvatar` — the agent PUTs bytes to `uploadUrl`, then finalizes with `s3Key`. */
|
|
561
|
+
interface AgentAvatarPresign {
|
|
562
|
+
/** Presigned PUT URL to upload the image bytes to. */
|
|
563
|
+
uploadUrl: string;
|
|
564
|
+
/** Object key — echoed back to `finalizeAvatar`. */
|
|
565
|
+
s3Key: string;
|
|
566
|
+
/** Stable public URL the avatar will be served from once finalized. */
|
|
567
|
+
publicUrl: string;
|
|
568
|
+
/** ISO expiry of the presigned PUT URL. */
|
|
569
|
+
expiresAt: string;
|
|
570
|
+
}
|
|
571
|
+
/** A voice in the platform catalogue (ElevenLabs), from `listVoices`. */
|
|
572
|
+
interface AgentVoice {
|
|
573
|
+
id: string;
|
|
574
|
+
name: string;
|
|
575
|
+
previewUrl: string;
|
|
576
|
+
description: string;
|
|
577
|
+
labels: Record<string, string>;
|
|
578
|
+
category: string;
|
|
579
|
+
}
|
|
580
|
+
declare class SelfApi extends ApiBase {
|
|
581
|
+
/** Update the agent's own name and/or voice config. Returns the updated agent. */
|
|
582
|
+
updateSelf(update: {
|
|
583
|
+
name?: string;
|
|
584
|
+
voiceConfig?: AgentVoiceConfig;
|
|
585
|
+
}): Promise<AgentSelf>;
|
|
586
|
+
/**
|
|
587
|
+
* Generate the agent's own avatar from a text prompt. The image is generated,
|
|
588
|
+
* stored, and set on the agent server-side; returns the updated agent.
|
|
589
|
+
*
|
|
590
|
+
* ASYNC (same reason as `generateImage`): avatar gen runs `gpt-image-1`
|
|
591
|
+
* (30–60s) which exceeds the API Gateway 30s ceiling, so this enqueues a job
|
|
592
|
+
* (`POST /agent/avatar/generate` → `jobId`) then polls (`GET /agent/avatar/{jobId}`)
|
|
593
|
+
* until the avatar is set. Signature unchanged — the plugin is unaffected.
|
|
594
|
+
*/
|
|
595
|
+
generateAvatar(args: {
|
|
596
|
+
prompt: string;
|
|
597
|
+
}): Promise<AgentSelf>;
|
|
598
|
+
/**
|
|
599
|
+
* Get a presigned PUT URL to upload a new avatar image. Upload the bytes to
|
|
600
|
+
* `uploadUrl`, then call `finalizeAvatar(s3Key)` to set it on the agent.
|
|
601
|
+
*/
|
|
602
|
+
presignAvatar(args: {
|
|
603
|
+
mimeType: string;
|
|
604
|
+
size: number;
|
|
605
|
+
}): Promise<AgentAvatarPresign>;
|
|
606
|
+
/**
|
|
607
|
+
* Finalize an avatar upload — validates ownership + size, then sets the
|
|
608
|
+
* agent's `avatarUrl` server-side. Returns the updated agent.
|
|
609
|
+
*/
|
|
610
|
+
finalizeAvatar(s3Key: string): Promise<AgentSelf>;
|
|
611
|
+
/** List the platform voice catalogue (ElevenLabs) so the agent can pick its own voice. */
|
|
612
|
+
listVoices(): Promise<{
|
|
613
|
+
voices: AgentVoice[];
|
|
614
|
+
}>;
|
|
615
|
+
}
|
|
616
|
+
//# sourceMappingURL=self.d.ts.map
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region src/domains/voice.d.ts
|
|
619
|
+
/** The ElevenLabs models with a pricing row — the TTS endpoint rejects any other value. */
|
|
620
|
+
type VoiceTtsModel = "eleven_turbo_v2_5" | "eleven_multilingual_v2";
|
|
621
|
+
interface VoiceTtsArgs {
|
|
622
|
+
/** Text to synthesize (1–5000 chars — the endpoint enforces this). */
|
|
623
|
+
text: string;
|
|
624
|
+
/** ElevenLabs voice id; platform default when unset. */
|
|
625
|
+
voiceId?: string;
|
|
626
|
+
/** TTS model; `eleven_turbo_v2_5` (lower latency) when unset. */
|
|
627
|
+
model?: VoiceTtsModel;
|
|
628
|
+
}
|
|
629
|
+
/** Raw synthesized audio plus its PCM framing (from the response headers). */
|
|
630
|
+
interface VoiceTtsResult {
|
|
631
|
+
/** Raw little-endian PCM samples — no container. Wrap in WAV to make a playable file. */
|
|
632
|
+
audio: Buffer;
|
|
633
|
+
/** Samples per second (e.g. 24000). */
|
|
634
|
+
sampleRate: number;
|
|
635
|
+
/** Channel count (mono = 1). */
|
|
636
|
+
channels: number;
|
|
637
|
+
/** Bits per sample (e.g. 16). */
|
|
638
|
+
bitDepth: number;
|
|
639
|
+
}
|
|
640
|
+
interface VoiceSttArgs {
|
|
641
|
+
/** Raw linear16 (16-bit little-endian) mono PCM samples — no WAV/container header. */
|
|
642
|
+
audio: Uint8Array;
|
|
643
|
+
/** Sample rate of `audio` in Hz (8000–48000). */
|
|
644
|
+
sampleRate: number;
|
|
645
|
+
}
|
|
646
|
+
interface VoiceSttResult {
|
|
647
|
+
text: string;
|
|
648
|
+
/** Deepgram confidence in (0,1]. */
|
|
649
|
+
confidence: number;
|
|
650
|
+
}
|
|
651
|
+
declare class VoiceApi extends ApiBase {
|
|
652
|
+
/**
|
|
653
|
+
* Text-to-speech. Returns raw PCM audio bytes plus their framing — the
|
|
654
|
+
* voice service defaults to 24 kHz / mono / 16-bit. Wrap in a WAV container
|
|
655
|
+
* to produce a playable file. Metered per character against the tenant
|
|
656
|
+
* credit pool server-side; TTS completes regardless of metering outcome.
|
|
657
|
+
*/
|
|
658
|
+
tts(args: VoiceTtsArgs): Promise<VoiceTtsResult>;
|
|
659
|
+
/**
|
|
660
|
+
* Speech-to-text. Accepts raw linear16 (16-bit LE) mono PCM — NOT a WAV or
|
|
661
|
+
* other container (the endpoint transcribes with a fixed linear16 encoding,
|
|
662
|
+
* so a container header would be transcribed as noise). Strip any WAV header
|
|
663
|
+
* and pass `sampleRate` from it before calling. Metered by transcribed
|
|
664
|
+
* duration against the tenant credit pool server-side.
|
|
665
|
+
*/
|
|
666
|
+
stt(args: VoiceSttArgs): Promise<VoiceSttResult>;
|
|
667
|
+
}
|
|
668
|
+
//# sourceMappingURL=voice.d.ts.map
|
|
669
|
+
//#endregion
|
|
670
|
+
//#region src/domains/search.d.ts
|
|
671
|
+
/**
|
|
672
|
+
* The broad-news providers behind the metered `services/news` Lambda. The
|
|
673
|
+
* server validates this with a zod enum; a value outside the union is an
|
|
674
|
+
* unpriceable product, so keep the literal union in lockstep with the service.
|
|
675
|
+
*/
|
|
676
|
+
type NewsProvider = "apitube" | "newsdata";
|
|
677
|
+
/** One normalized article. `sentiment` is provider-shaped (APITube supplies it). */
|
|
678
|
+
interface NewsArticle {
|
|
679
|
+
title: string;
|
|
680
|
+
url: string;
|
|
681
|
+
source: string;
|
|
682
|
+
publishedAt: string;
|
|
683
|
+
snippet: string;
|
|
684
|
+
sentiment?: unknown;
|
|
685
|
+
}
|
|
686
|
+
/** Provider-agnostic result — the server normalizes every adapter to this. */
|
|
687
|
+
interface NewsResult {
|
|
688
|
+
articles: NewsArticle[];
|
|
689
|
+
provider: string;
|
|
690
|
+
}
|
|
691
|
+
declare class SearchApi extends ApiBase {
|
|
692
|
+
searchWeb(params: {
|
|
693
|
+
query: string;
|
|
694
|
+
count?: number;
|
|
695
|
+
offset?: number;
|
|
696
|
+
country?: string;
|
|
697
|
+
freshness?: string;
|
|
698
|
+
}, options?: {
|
|
699
|
+
signal?: AbortSignal;
|
|
700
|
+
}): Promise<unknown>;
|
|
701
|
+
searchImages(params: {
|
|
702
|
+
query: string;
|
|
703
|
+
count?: number;
|
|
704
|
+
}, options?: {
|
|
705
|
+
signal?: AbortSignal;
|
|
706
|
+
}): Promise<unknown>;
|
|
707
|
+
searchNews(params: {
|
|
708
|
+
query: string;
|
|
709
|
+
count?: number;
|
|
710
|
+
offset?: number;
|
|
711
|
+
freshness?: string;
|
|
712
|
+
}, options?: {
|
|
713
|
+
signal?: AbortSignal;
|
|
714
|
+
}): Promise<unknown>;
|
|
715
|
+
/** Search news across the selected provider's corpus. → POST /agent/news/search */
|
|
716
|
+
newsSearch(params: {
|
|
717
|
+
query: string;
|
|
718
|
+
provider?: NewsProvider;
|
|
719
|
+
source?: string;
|
|
720
|
+
from?: string;
|
|
721
|
+
to?: string;
|
|
722
|
+
language?: string;
|
|
723
|
+
category?: string;
|
|
724
|
+
limit?: number;
|
|
725
|
+
}): Promise<NewsResult>;
|
|
726
|
+
/** Top headlines for the selected provider. → POST /agent/news/headlines */
|
|
727
|
+
newsHeadlines(params?: {
|
|
728
|
+
provider?: NewsProvider;
|
|
729
|
+
category?: string;
|
|
730
|
+
source?: string;
|
|
731
|
+
language?: string;
|
|
732
|
+
limit?: number;
|
|
733
|
+
}): Promise<NewsResult>;
|
|
734
|
+
}
|
|
735
|
+
//# sourceMappingURL=search.d.ts.map
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region src/domains/webhooks.d.ts
|
|
738
|
+
interface AgentWebhook {
|
|
739
|
+
webhookId: string;
|
|
740
|
+
tenantId: string;
|
|
741
|
+
agentId: string;
|
|
742
|
+
name: string;
|
|
743
|
+
provider: string;
|
|
744
|
+
active: boolean;
|
|
745
|
+
createdBy: string;
|
|
746
|
+
createdAt: string;
|
|
747
|
+
updatedAt: string;
|
|
748
|
+
}
|
|
749
|
+
interface CreatedAgentWebhook extends AgentWebhook {
|
|
750
|
+
url: string;
|
|
751
|
+
signingSecret: string;
|
|
752
|
+
}
|
|
753
|
+
interface AgentWebhookDelivery {
|
|
754
|
+
deliveryId: string;
|
|
755
|
+
webhookId: string;
|
|
756
|
+
status: string;
|
|
757
|
+
attempts: number;
|
|
758
|
+
createdAt: string;
|
|
759
|
+
deliveredAt?: string;
|
|
760
|
+
}
|
|
761
|
+
declare class WebhooksApi extends ApiBase {
|
|
762
|
+
createWebhook(args: {
|
|
763
|
+
name: string;
|
|
764
|
+
provider?: "generic" | "github" | "stripe" | "slack";
|
|
765
|
+
}): Promise<CreatedAgentWebhook>;
|
|
766
|
+
listWebhooks(): Promise<AgentWebhook[]>;
|
|
767
|
+
deleteWebhook(webhookId: string): Promise<{
|
|
768
|
+
webhookId: string;
|
|
769
|
+
active: false;
|
|
770
|
+
}>;
|
|
771
|
+
rotateWebhookSecret(webhookId: string): Promise<{
|
|
772
|
+
webhookId: string;
|
|
773
|
+
signingSecret: string;
|
|
774
|
+
}>;
|
|
775
|
+
listWebhookDeliveries(webhookId: string): Promise<AgentWebhookDelivery[]>;
|
|
776
|
+
}
|
|
777
|
+
//# sourceMappingURL=webhooks.d.ts.map
|
|
778
|
+
//#endregion
|
|
779
|
+
//#region src/domains/chat.d.ts
|
|
780
|
+
declare class ChatApi extends ApiBase {
|
|
781
|
+
presignAttachments(files: {
|
|
782
|
+
filename: string;
|
|
783
|
+
mimeType: string;
|
|
784
|
+
size: number;
|
|
785
|
+
}[]): Promise<{
|
|
786
|
+
attachments: {
|
|
787
|
+
id: string;
|
|
788
|
+
uploadUrl: string;
|
|
789
|
+
downloadUrl: string;
|
|
790
|
+
s3Key: string;
|
|
791
|
+
expiresAt: string;
|
|
792
|
+
}[];
|
|
793
|
+
}>;
|
|
794
|
+
recordActivity(data: {
|
|
795
|
+
userId?: string;
|
|
796
|
+
channel: string;
|
|
797
|
+
role: "user" | "assistant";
|
|
798
|
+
}): Promise<{
|
|
799
|
+
recorded: boolean;
|
|
800
|
+
}>;
|
|
801
|
+
}
|
|
802
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
803
|
+
//#endregion
|
|
804
|
+
//#region src/domains/connect-credentials.d.ts
|
|
805
|
+
declare class ConnectCredentialsApi extends ApiBase {
|
|
806
|
+
/**
|
|
807
|
+
* Returns every connected Google account for the agent. Multi-account by
|
|
808
|
+
* design — the openclaw-google plugin requires the LLM to pass `email`
|
|
809
|
+
* explicitly to `google_run_command` so an account is always selected
|
|
810
|
+
* deliberately.
|
|
811
|
+
*
|
|
812
|
+
* 2026-05-14 (connections-redesign PR 1): the legacy flat shape (`email`,
|
|
813
|
+
* `refreshToken`, `accessToken`, etc., populated from the default account)
|
|
814
|
+
* is gone. Iterate over `accounts`.
|
|
815
|
+
*/
|
|
816
|
+
getGoogleCredentials(): Promise<{
|
|
817
|
+
accounts: {
|
|
818
|
+
email: string;
|
|
819
|
+
refreshToken: string;
|
|
820
|
+
clientId: string;
|
|
821
|
+
clientSecret: string;
|
|
822
|
+
displayName?: string;
|
|
823
|
+
connectedAt?: string;
|
|
824
|
+
}[];
|
|
825
|
+
}>;
|
|
826
|
+
disconnectGoogleAccount(email: string): Promise<{
|
|
827
|
+
accounts: {
|
|
828
|
+
email: string;
|
|
829
|
+
displayName?: string;
|
|
830
|
+
connectedAt?: string;
|
|
831
|
+
}[];
|
|
832
|
+
}>;
|
|
833
|
+
getGoogleChatCredentials(): Promise<{
|
|
834
|
+
email: string;
|
|
835
|
+
refreshToken: string;
|
|
836
|
+
clientId: string;
|
|
837
|
+
clientSecret: string;
|
|
838
|
+
displayName?: string;
|
|
839
|
+
}>;
|
|
840
|
+
/**
|
|
841
|
+
* Fetch decrypted credentials for ONE specific connection by its
|
|
842
|
+
* stable connectionId (connection-scoped, vs the provider-scoped
|
|
843
|
+
* `get<Provider>Credentials` helpers). Used by the daemon to resolve
|
|
844
|
+
* a Custom Connection-driven integration's credentials from the
|
|
845
|
+
* exact connection it was installed from — every custom connection
|
|
846
|
+
* shares the `custom` provider id, so provider-scoping is ambiguous.
|
|
847
|
+
*
|
|
848
|
+
* For custom connections `accessToken` is the JSON-encoded secret
|
|
849
|
+
* bundle (the daemon un-bundles it); non-secret fields are on
|
|
850
|
+
* `providerMetadata`. The endpoint enforces that the connection is in
|
|
851
|
+
* the calling agent's effective scope (403 otherwise).
|
|
852
|
+
*/
|
|
853
|
+
getConnectionCredentials(connectionId: string): Promise<{
|
|
854
|
+
provider: string;
|
|
855
|
+
connectionId: string;
|
|
856
|
+
accountIdentifier?: string;
|
|
857
|
+
accessToken?: string;
|
|
858
|
+
providerMetadata?: Record<string, unknown>;
|
|
859
|
+
[key: string]: unknown;
|
|
860
|
+
}>;
|
|
861
|
+
/**
|
|
862
|
+
* @deprecated Returns a single primary credential blob (legacy "pick-the-
|
|
863
|
+
* default-connection" shape). Use `getGithubAccounts()` for the multi-
|
|
864
|
+
* account shape required by Pattern A — explicit selector args on every
|
|
865
|
+
* tool. Retained because the `@alfe.ai/github-mcp` proxy is the
|
|
866
|
+
* only consumer that knows about Pattern A; legacy env-interpolation
|
|
867
|
+
* callers will keep hitting `/credentials` until they move to the proxy.
|
|
868
|
+
*/
|
|
869
|
+
getGithubCredentials(): Promise<{
|
|
870
|
+
login: string;
|
|
871
|
+
accessToken: string;
|
|
872
|
+
}>;
|
|
873
|
+
/**
|
|
874
|
+
* Pattern A: multi-account credential fetch for GitHub.
|
|
875
|
+
*
|
|
876
|
+
* Returns every agent-scoped GitHub connection. The caller is expected
|
|
877
|
+
* to require a `login` selector on every credential-touching tool and
|
|
878
|
+
* look up the matching account at dispatch time.
|
|
879
|
+
*
|
|
880
|
+
* GitHub OAuth tokens have no expiry (`tokenLifecycle: "no_expiry"`),
|
|
881
|
+
* so there is intentionally no `refreshGithubAccountToken` method — if
|
|
882
|
+
* a token is revoked the user must re-run the OAuth flow.
|
|
883
|
+
*
|
|
884
|
+
* Returned `accounts[i].login` is the GitHub username — the stable
|
|
885
|
+
* cross-session identifier the LLM should pass.
|
|
886
|
+
*/
|
|
887
|
+
getGithubAccounts(): Promise<{
|
|
888
|
+
accounts: {
|
|
889
|
+
connectionId: string;
|
|
890
|
+
accountIdentifier: string;
|
|
891
|
+
displayName: string | null;
|
|
892
|
+
connectedAt: string;
|
|
893
|
+
accessToken: string;
|
|
894
|
+
login: string;
|
|
895
|
+
scopes: string;
|
|
896
|
+
}[];
|
|
897
|
+
}>;
|
|
898
|
+
/**
|
|
899
|
+
* @deprecated Returns a single primary credential blob (legacy "pick-the-
|
|
900
|
+
* default-connection" shape). Use `getXeroAccounts()` for the multi-
|
|
901
|
+
* account shape required by Pattern A — explicit selector args on every
|
|
902
|
+
* tool. This method will be removed once all consumers migrate.
|
|
903
|
+
*/
|
|
904
|
+
getXeroCredentials(): Promise<{
|
|
905
|
+
accessToken: string;
|
|
906
|
+
accessTokenExpiresAt: string;
|
|
907
|
+
xeroTenantId: string;
|
|
908
|
+
}>;
|
|
909
|
+
/**
|
|
910
|
+
* Pattern A: multi-account credential fetch for Xero. Returns every
|
|
911
|
+
* agent-scoped Xero connection. The caller is expected to require a
|
|
912
|
+
* selector arg (e.g. `xeroTenantId`) on every credential-touching tool
|
|
913
|
+
* and look up the matching account by that selector at dispatch time.
|
|
914
|
+
*
|
|
915
|
+
* `xeroTenantId` is the model-facing organisation selector. The separate
|
|
916
|
+
* `accountIdentifier` is the Connect persistence key used for refresh and
|
|
917
|
+
* may be an email; never substitute one for the other.
|
|
918
|
+
*/
|
|
919
|
+
getXeroAccounts(): Promise<{
|
|
920
|
+
accounts: {
|
|
921
|
+
connectionId: string;
|
|
922
|
+
accountIdentifier: string;
|
|
923
|
+
displayName: string | null;
|
|
924
|
+
connectedAt: string;
|
|
925
|
+
accessToken: string;
|
|
926
|
+
accessTokenExpiresAt: string;
|
|
927
|
+
xeroTenantId: string;
|
|
928
|
+
}[];
|
|
929
|
+
}>;
|
|
930
|
+
refreshXeroToken(): Promise<{
|
|
931
|
+
accessToken: string;
|
|
932
|
+
expiresAt: string;
|
|
933
|
+
}>;
|
|
934
|
+
/**
|
|
935
|
+
* Refresh a specific Xero Connection by its exact `accountIdentifier` from
|
|
936
|
+
* `getXeroAccounts()`. Do not substitute `xeroTenantId`: current Xero OAuth
|
|
937
|
+
* rows may use the account email as their persistence key even when a sole
|
|
938
|
+
* organisation tenant ID is available in provider metadata.
|
|
939
|
+
*/
|
|
940
|
+
refreshXeroAccountToken(accountIdentifier: string): Promise<{
|
|
941
|
+
accessToken: string;
|
|
942
|
+
accessTokenExpiresAt: string;
|
|
943
|
+
expiresAt: string;
|
|
944
|
+
}>;
|
|
945
|
+
/**
|
|
946
|
+
* @deprecated Returns a single primary credential blob (legacy "pick-the-
|
|
947
|
+
* default-connection" shape). Use `getNotionAccounts()` for the multi-
|
|
948
|
+
* account shape required by Pattern A.
|
|
949
|
+
*/
|
|
950
|
+
getNotionCredentials(): Promise<{
|
|
951
|
+
accessToken: string;
|
|
952
|
+
workspaceId: string;
|
|
953
|
+
workspaceName: string;
|
|
954
|
+
}>;
|
|
955
|
+
/**
|
|
956
|
+
* Pattern A: multi-account credential fetch for Notion. Returns every
|
|
957
|
+
* agent-scoped Notion connection. The caller is expected to require a
|
|
958
|
+
* selector arg (e.g. `workspaceId`) on every credential-touching tool.
|
|
959
|
+
*
|
|
960
|
+
* Returned `accounts[i].accountIdentifier` is the Notion workspaceId.
|
|
961
|
+
*/
|
|
962
|
+
getNotionAccounts(): Promise<{
|
|
963
|
+
accounts: {
|
|
964
|
+
connectionId: string;
|
|
965
|
+
accountIdentifier: string;
|
|
966
|
+
displayName: string | null;
|
|
967
|
+
connectedAt: string;
|
|
968
|
+
accessToken: string;
|
|
969
|
+
workspaceId: string;
|
|
970
|
+
workspaceName: string;
|
|
971
|
+
}[];
|
|
972
|
+
}>;
|
|
973
|
+
/**
|
|
974
|
+
* @deprecated Returns a single primary Atlassian Connection's credentials
|
|
975
|
+
* (one OAuth user, one cloudId) — the legacy "pick-the-default-connection"
|
|
976
|
+
* shape. Atlassian is multi-site by nature (each OAuth user may have
|
|
977
|
+
* access to multiple Cloud sites), so Pattern A plugins MUST use
|
|
978
|
+
* `getAtlassianAccounts()` to discover the full set and dispatch via
|
|
979
|
+
* the `cloudId` selector arg.
|
|
980
|
+
*/
|
|
981
|
+
getAtlassianCredentials(): Promise<{
|
|
982
|
+
accessToken: string;
|
|
983
|
+
refreshToken: string;
|
|
984
|
+
accessTokenExpiresAt: string;
|
|
985
|
+
cloudId: string;
|
|
986
|
+
siteName: string;
|
|
987
|
+
siteUrl: string;
|
|
988
|
+
email: string;
|
|
989
|
+
enabledProducts: string[];
|
|
990
|
+
clientId: string;
|
|
991
|
+
clientSecret: string;
|
|
992
|
+
}>;
|
|
993
|
+
refreshAtlassianToken(): Promise<{
|
|
994
|
+
accessToken: string;
|
|
995
|
+
expiresAt: string;
|
|
996
|
+
}>;
|
|
997
|
+
/**
|
|
998
|
+
* Pattern A: multi-account / multi-site credential fetch for Atlassian.
|
|
999
|
+
*
|
|
1000
|
+
* Returns every agent-scoped Atlassian Connection. Each Connection is
|
|
1001
|
+
* one OAuth user with a single access token and N accessible Cloud
|
|
1002
|
+
* sites (`availableSites`). The caller is expected to:
|
|
1003
|
+
*
|
|
1004
|
+
* 1. Flatten (connection × cloudId) into one MCP child per site.
|
|
1005
|
+
* 2. Require a `cloudId` selector on every credential-touching tool.
|
|
1006
|
+
* 3. Use the access token bound to the Connection that owns the
|
|
1007
|
+
* requested `cloudId` (Atlassian shares one access token across
|
|
1008
|
+
* all sites accessible to the OAuth user).
|
|
1009
|
+
*
|
|
1010
|
+
* Per-account token refresh uses `refreshAtlassianAccountToken(email)`
|
|
1011
|
+
* — refreshing one Connection rotates its single access token, which
|
|
1012
|
+
* then applies to every cloudId for that Connection.
|
|
1013
|
+
*
|
|
1014
|
+
* Returned `accounts[i].accountIdentifier` is the OAuth user's email
|
|
1015
|
+
* — the stable cross-session identifier for refresh purposes. The LLM
|
|
1016
|
+
* never sees this directly: it picks a site via the `cloudId` arg
|
|
1017
|
+
* instead.
|
|
1018
|
+
*/
|
|
1019
|
+
getAtlassianAccounts(): Promise<{
|
|
1020
|
+
accounts: {
|
|
1021
|
+
connectionId: string;
|
|
1022
|
+
accountIdentifier: string;
|
|
1023
|
+
displayName: string | null;
|
|
1024
|
+
connectedAt: string;
|
|
1025
|
+
accessToken: string;
|
|
1026
|
+
accessTokenExpiresAt: string;
|
|
1027
|
+
clientId: string;
|
|
1028
|
+
clientSecret: string;
|
|
1029
|
+
cloudId: string;
|
|
1030
|
+
siteName: string;
|
|
1031
|
+
siteUrl: string;
|
|
1032
|
+
availableSites: {
|
|
1033
|
+
id: string;
|
|
1034
|
+
url: string;
|
|
1035
|
+
name: string;
|
|
1036
|
+
scopes?: string[];
|
|
1037
|
+
avatarUrl?: string;
|
|
1038
|
+
}[];
|
|
1039
|
+
}[];
|
|
1040
|
+
}>;
|
|
1041
|
+
/**
|
|
1042
|
+
* Pattern A: refresh a specific Atlassian Connection by `accountIdentifier`
|
|
1043
|
+
* (the OAuth user's email).
|
|
1044
|
+
*
|
|
1045
|
+
* Atlassian rotates refresh tokens (`rotatesRefreshToken: true`); the
|
|
1046
|
+
* server-side per-account refresh endpoint handles rotation and
|
|
1047
|
+
* persistence. Refreshing one Connection updates its single access
|
|
1048
|
+
* token, which applies to every accessible Cloud site (cloudId) for
|
|
1049
|
+
* that OAuth user.
|
|
1050
|
+
*
|
|
1051
|
+
* Returns the new access token + expiry. The proxy is responsible for
|
|
1052
|
+
* fanning the new token out to every child server it spawned for
|
|
1053
|
+
* cloudIds owned by this Connection.
|
|
1054
|
+
*/
|
|
1055
|
+
refreshAtlassianAccountToken(accountIdentifier: string): Promise<{
|
|
1056
|
+
accessToken: string;
|
|
1057
|
+
accessTokenExpiresAt: string;
|
|
1058
|
+
expiresAt: string;
|
|
1059
|
+
}>;
|
|
1060
|
+
/**
|
|
1061
|
+
* @deprecated Returns a single primary credential blob (legacy "pick-the-
|
|
1062
|
+
* default-connection" shape). Use `getMYOBAccounts()` for the multi-
|
|
1063
|
+
* account shape required by Pattern A.
|
|
1064
|
+
*/
|
|
1065
|
+
getMYOBCredentials(): Promise<{
|
|
1066
|
+
accessToken: string;
|
|
1067
|
+
accessTokenExpiresAt: string;
|
|
1068
|
+
myobBusinessId: string;
|
|
1069
|
+
clientId: string;
|
|
1070
|
+
}>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Pattern A: multi-account credential fetch for MYOB. Returns every
|
|
1073
|
+
* agent-scoped MYOB connection. The caller is expected to require a
|
|
1074
|
+
* selector arg (e.g. `myobBusinessId` / `accountIdentifier`) on every
|
|
1075
|
+
* credential-touching tool.
|
|
1076
|
+
*
|
|
1077
|
+
* Returned `accounts[i].accountIdentifier` is the MYOB businessId.
|
|
1078
|
+
*/
|
|
1079
|
+
getMYOBAccounts(): Promise<{
|
|
1080
|
+
accounts: {
|
|
1081
|
+
connectionId: string;
|
|
1082
|
+
accountIdentifier: string;
|
|
1083
|
+
displayName: string | null;
|
|
1084
|
+
connectedAt: string;
|
|
1085
|
+
accessToken: string;
|
|
1086
|
+
accessTokenExpiresAt: string;
|
|
1087
|
+
myobBusinessId: string;
|
|
1088
|
+
clientId: string;
|
|
1089
|
+
}[];
|
|
1090
|
+
}>;
|
|
1091
|
+
refreshMYOBToken(): Promise<{
|
|
1092
|
+
accessToken: string;
|
|
1093
|
+
expiresAt: string;
|
|
1094
|
+
}>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Pattern A: refresh one MYOB Connection by its stable
|
|
1097
|
+
* `accountIdentifier` (the MYOB business id returned by
|
|
1098
|
+
* `getMYOBAccounts()`).
|
|
1099
|
+
*
|
|
1100
|
+
* MYOB refresh tokens belong to individual Connection rows. A
|
|
1101
|
+
* multi-business client must use this method instead of refreshing the
|
|
1102
|
+
* primary Connection and copying that access token into every cached
|
|
1103
|
+
* business client.
|
|
1104
|
+
*/
|
|
1105
|
+
refreshMYOBAccountToken(accountIdentifier: string): Promise<{
|
|
1106
|
+
accessToken: string;
|
|
1107
|
+
accessTokenExpiresAt: string;
|
|
1108
|
+
expiresAt: string;
|
|
1109
|
+
}>;
|
|
1110
|
+
/**
|
|
1111
|
+
* @deprecated Returns a single primary credential blob. Use
|
|
1112
|
+
* `getSalesforceAccounts()` for the multi-account shape required by
|
|
1113
|
+
* Pattern A.
|
|
1114
|
+
*/
|
|
1115
|
+
getSalesforceCredentials(): Promise<{
|
|
1116
|
+
accessToken: string;
|
|
1117
|
+
accessTokenExpiresAt: string;
|
|
1118
|
+
instanceUrl: string;
|
|
1119
|
+
orgId: string;
|
|
1120
|
+
}>;
|
|
1121
|
+
/**
|
|
1122
|
+
* Pattern A: multi-account credential fetch for Salesforce. Returns every
|
|
1123
|
+
* agent-scoped Salesforce connection. One OAuth grant maps to one org, so
|
|
1124
|
+
* `accounts[i].accountIdentifier` (and `orgId`) is the Salesforce org id —
|
|
1125
|
+
* the selector every credential-touching tool requires.
|
|
1126
|
+
*/
|
|
1127
|
+
getSalesforceAccounts(): Promise<{
|
|
1128
|
+
accounts: {
|
|
1129
|
+
connectionId: string;
|
|
1130
|
+
accountIdentifier: string;
|
|
1131
|
+
displayName: string | null;
|
|
1132
|
+
connectedAt: string;
|
|
1133
|
+
accessToken: string;
|
|
1134
|
+
accessTokenExpiresAt: string;
|
|
1135
|
+
instanceUrl: string;
|
|
1136
|
+
orgId: string;
|
|
1137
|
+
}[];
|
|
1138
|
+
}>;
|
|
1139
|
+
/**
|
|
1140
|
+
* Refresh the access token for a specific Salesforce org. Salesforce
|
|
1141
|
+
* tokens aren't interchangeable across orgs, so the connection is targeted
|
|
1142
|
+
* by `accountIdentifier` (the org id) — mirrors `refreshXeroAccountToken`.
|
|
1143
|
+
*/
|
|
1144
|
+
refreshSalesforceAccountToken(orgId: string): Promise<{
|
|
1145
|
+
accessToken: string;
|
|
1146
|
+
accessTokenExpiresAt: string;
|
|
1147
|
+
expiresAt: string;
|
|
1148
|
+
}>;
|
|
1149
|
+
/**
|
|
1150
|
+
* Pattern A: multi-account credential fetch for Microsoft 365.
|
|
1151
|
+
*
|
|
1152
|
+
* Returns every agent-scoped Microsoft connection. The caller is expected
|
|
1153
|
+
* to require an `email` selector on every credential-touching tool and
|
|
1154
|
+
* look up the matching account at dispatch time.
|
|
1155
|
+
*
|
|
1156
|
+
* Returned `accounts[i].accountIdentifier` is the user's primary email
|
|
1157
|
+
* (or the tid claim as fallback) — the stable cross-session identifier
|
|
1158
|
+
* the LLM should pass.
|
|
1159
|
+
*
|
|
1160
|
+
* Per-account token refresh is exposed via `refreshMicrosoftAccountToken`,
|
|
1161
|
+
* NOT `refreshXeroAccountToken` — Microsoft refresh tokens are not
|
|
1162
|
+
* interchangeable across (tenant, user) pairs.
|
|
1163
|
+
*/
|
|
1164
|
+
getMicrosoftAccounts(): Promise<{
|
|
1165
|
+
accounts: {
|
|
1166
|
+
connectionId: string;
|
|
1167
|
+
accountIdentifier: string;
|
|
1168
|
+
displayName: string | null;
|
|
1169
|
+
connectedAt: string;
|
|
1170
|
+
accessToken: string;
|
|
1171
|
+
accessTokenExpiresAt: string;
|
|
1172
|
+
email: string;
|
|
1173
|
+
microsoftTenantId: string;
|
|
1174
|
+
workspaceDomain: string;
|
|
1175
|
+
}[];
|
|
1176
|
+
}>;
|
|
1177
|
+
/**
|
|
1178
|
+
* Pattern A: refresh a specific Microsoft 365 connection by its
|
|
1179
|
+
* `accountIdentifier`. For Microsoft, `accountIdentifier` is the user's
|
|
1180
|
+
* email when the Graph profile fetch succeeded at connect time, and the
|
|
1181
|
+
* Azure tenant id (`tid` claim) as fallback. Callers should pass the
|
|
1182
|
+
* value returned by `getMicrosoftAccounts()` rather than synthesising
|
|
1183
|
+
* an email locally.
|
|
1184
|
+
*
|
|
1185
|
+
* Microsoft refresh tokens are bound to a specific (tenant, user) pair —
|
|
1186
|
+
* they are NOT interchangeable across accounts, so per-account refresh
|
|
1187
|
+
* is mandatory. The generic /accounts/{accountIdentifier}/refresh
|
|
1188
|
+
* endpoint walks the agent's full visible scope chain to find a matching
|
|
1189
|
+
* connection (works for inherited team/project Microsoft connections).
|
|
1190
|
+
*/
|
|
1191
|
+
refreshMicrosoftAccountToken(accountIdentifier: string): Promise<{
|
|
1192
|
+
accessToken: string;
|
|
1193
|
+
accessTokenExpiresAt: string;
|
|
1194
|
+
expiresAt: string;
|
|
1195
|
+
}>;
|
|
1196
|
+
/**
|
|
1197
|
+
* Disconnects one connected Microsoft 365 account for the agent, by its
|
|
1198
|
+
* `accountIdentifier`. Hits the generic per-account disconnect route
|
|
1199
|
+
* (`DELETE /agent/connect/microsoft/accounts/{accountIdentifier}`), which
|
|
1200
|
+
* resolves across the agent's full effective scope chain and deletes the
|
|
1201
|
+
* matching Connection row. Returns the remaining accounts.
|
|
1202
|
+
*
|
|
1203
|
+
* IMPORTANT: pass the `accountIdentifier` from `getMicrosoftAccounts()`, NOT
|
|
1204
|
+
* a synthesised email. For Microsoft, `accountIdentifier` is the user's email
|
|
1205
|
+
* only when the Graph profile fetch succeeded at connect time; it falls back
|
|
1206
|
+
* to the Azure tenant id (`tid` claim) otherwise. The backend matches on
|
|
1207
|
+
* `accountIdentifier` exactly, so passing an email would 404 on those
|
|
1208
|
+
* fallback-identifier accounts. (This is why the param is not named `email`,
|
|
1209
|
+
* unlike `disconnectGoogleAccount` where the identifier is always the email.)
|
|
1210
|
+
*/
|
|
1211
|
+
disconnectMicrosoftAccount(accountIdentifier: string): Promise<{
|
|
1212
|
+
accounts: {
|
|
1213
|
+
accountIdentifier: string;
|
|
1214
|
+
displayName?: string;
|
|
1215
|
+
connectedAt?: string;
|
|
1216
|
+
}[];
|
|
1217
|
+
}>;
|
|
1218
|
+
/**
|
|
1219
|
+
* Resolve the primary cTrader Connection's credentials for the calling
|
|
1220
|
+
* agent. Unlike most providers, the cTrader Open API needs app-level auth
|
|
1221
|
+
* (`clientId` + `clientSecret`) AND account auth (`accessToken` +
|
|
1222
|
+
* `accountId`) on the socket, so `@alfe.ai/ctrader-mcp` self-fetches the
|
|
1223
|
+
* full set here at startup (the atlassian/google pattern). `clientId` /
|
|
1224
|
+
* `clientSecret` are the SST-sourced global app credentials the connect
|
|
1225
|
+
* endpoint injects — they are never persisted on the connection. `host` is
|
|
1226
|
+
* the resolved TLS endpoint (`live.ctraderapi.com` / `demo.ctraderapi.com`)
|
|
1227
|
+
* derived from the selected account's live/demo flag.
|
|
1228
|
+
*/
|
|
1229
|
+
getCTraderCredentials(): Promise<{
|
|
1230
|
+
accessToken: string;
|
|
1231
|
+
refreshToken: string;
|
|
1232
|
+
accountId: string;
|
|
1233
|
+
host: string;
|
|
1234
|
+
clientId: string;
|
|
1235
|
+
clientSecret: string;
|
|
1236
|
+
}>;
|
|
1237
|
+
/**
|
|
1238
|
+
* Pattern A: multi-account credential fetch for cTrader.
|
|
1239
|
+
*
|
|
1240
|
+
* Unlike atlassian/salesforce (one Connection row per account/site), a
|
|
1241
|
+
* cTrader is MULTI-grant per agent: an agent may connect several distinct
|
|
1242
|
+
* cTrader logins, each its own Connection row keyed on `accountIdentifier =
|
|
1243
|
+
* ctid:<userId>` (Phase 1). This aggregates the *trading accounts* across
|
|
1244
|
+
* ALL of those Connection rows — each row contributes its `availableAccounts`
|
|
1245
|
+
* flattened, and every account carries ITS OWN grant's `accessToken` (the
|
|
1246
|
+
* token that authenticates that account against the cTrader Open API). One
|
|
1247
|
+
* OAuth grant still covers all accounts under that single login on one shared
|
|
1248
|
+
* token; only the `ctidTraderAccountId` and the protobuf socket `host` (live
|
|
1249
|
+
* vs demo) differ within a grant. Across grants the tokens differ, so the
|
|
1250
|
+
* token is now PER-ACCOUNT rather than hoisted to the top level.
|
|
1251
|
+
*
|
|
1252
|
+
* `host` per account is derived from the account's `isLive` flag
|
|
1253
|
+
* (`live.ctraderapi.com` / `demo.ctraderapi.com`) — the same mapping the
|
|
1254
|
+
* connect provider applies server-side when an account is auto-selected.
|
|
1255
|
+
*
|
|
1256
|
+
* `clientId` / `clientSecret` are the SST-sourced GLOBAL app credentials the
|
|
1257
|
+
* connect endpoint injects — identical across every Connection row (one
|
|
1258
|
+
* cTrader app), never persisted on a connection. We take them from the first
|
|
1259
|
+
* row that carries them.
|
|
1260
|
+
*
|
|
1261
|
+
* Accounts are deduped on `ctidTraderAccountId` first-wins: Spotware ids are
|
|
1262
|
+
* globally unique across logins, so a duplicate can only appear if the same
|
|
1263
|
+
* account somehow surfaced under two grants — first-wins keeps it
|
|
1264
|
+
* deterministic.
|
|
1265
|
+
*
|
|
1266
|
+
* `accounts` may be empty (no cTrader Connection at all), in which case we
|
|
1267
|
+
* return empty creds rather than throwing.
|
|
1268
|
+
*/
|
|
1269
|
+
getCTraderAccounts(): Promise<{
|
|
1270
|
+
accounts: {
|
|
1271
|
+
ctidTraderAccountId: string;
|
|
1272
|
+
host: string;
|
|
1273
|
+
isLive: boolean;
|
|
1274
|
+
brokerName?: string;
|
|
1275
|
+
accountNumber?: string;
|
|
1276
|
+
accessToken: string;
|
|
1277
|
+
}[];
|
|
1278
|
+
clientId: string;
|
|
1279
|
+
clientSecret: string;
|
|
1280
|
+
}>;
|
|
1281
|
+
/**
|
|
1282
|
+
* @deprecated Returns a single primary credential blob. Use
|
|
1283
|
+
* `getShopifyAccounts()` for the multi-account shape required by Pattern A
|
|
1284
|
+
* (`@alfe.ai/shopify-mcp` keys per-shop on the myshopify domain).
|
|
1285
|
+
*/
|
|
1286
|
+
getShopifyCredentials(): Promise<{
|
|
1287
|
+
accessToken: string;
|
|
1288
|
+
shopDomain: string;
|
|
1289
|
+
shopGid: string;
|
|
1290
|
+
shopName: string;
|
|
1291
|
+
apiVersion: string;
|
|
1292
|
+
}>;
|
|
1293
|
+
/**
|
|
1294
|
+
* Pattern A: multi-account credential fetch for Shopify. Returns every
|
|
1295
|
+
* agent-scoped Shopify Connection. One OAuth grant maps to one store, so the
|
|
1296
|
+
* stable per-call selector is the store's myshopify domain (`shopDomain`),
|
|
1297
|
+
* NOT `accountIdentifier` — the connect provider keys `accountIdentifier` on
|
|
1298
|
+
* the immutable shop GID (falling back to the domain), so `shopDomain` is the
|
|
1299
|
+
* value the LLM passes and the plugin routes on.
|
|
1300
|
+
*
|
|
1301
|
+
* Each entry is shaped by the connect provider's `buildCredentialsResponse`:
|
|
1302
|
+
* `{ accessToken, shopDomain, shopGid, shopName, apiVersion }` — offline
|
|
1303
|
+
* Shopify tokens never expire, so there is NO token / expiry field and no
|
|
1304
|
+
* refresh method (unlike Salesforce). The GraphQL Admin API authenticates
|
|
1305
|
+
* purely on `X-Shopify-Access-Token`; no client credentials are on the wire.
|
|
1306
|
+
*/
|
|
1307
|
+
getShopifyAccounts(): Promise<{
|
|
1308
|
+
accounts: {
|
|
1309
|
+
connectionId: string;
|
|
1310
|
+
accountIdentifier: string;
|
|
1311
|
+
displayName: string | null;
|
|
1312
|
+
connectedAt: string;
|
|
1313
|
+
accessToken: string;
|
|
1314
|
+
shopDomain: string;
|
|
1315
|
+
shopGid: string;
|
|
1316
|
+
shopName: string;
|
|
1317
|
+
apiVersion: string;
|
|
1318
|
+
}[];
|
|
1319
|
+
}>;
|
|
1320
|
+
/**
|
|
1321
|
+
* Pattern A: provider-parameterized multi-account credential fetch for the
|
|
1322
|
+
* social connectors (Bluesky, and the approval-gated backlog: X, Meta,
|
|
1323
|
+
* Threads, LinkedIn, Pinterest, TikTok, Reddit, YouTube).
|
|
1324
|
+
*
|
|
1325
|
+
* Unlike the bespoke `getGithubAccounts()` / `getXeroAccounts()` shapes,
|
|
1326
|
+
* this returns a UNIFORM normalized account shape so `@alfe.ai/social-mcp`'s
|
|
1327
|
+
* shared driver can require a single `account` selector on every
|
|
1328
|
+
* credential-touching tool regardless of platform. The backend
|
|
1329
|
+
* `api-agents/{provider}/accounts` route is already provider-generic; this
|
|
1330
|
+
* is the client-side normalization the plan (`do-we-need-any-moonlit-toucan`
|
|
1331
|
+
* Phase 0, step 5) calls for.
|
|
1332
|
+
*
|
|
1333
|
+
* `accountIdentifier` is the stable per-account selector the LLM should
|
|
1334
|
+
* pass back (for Bluesky: the account DID). `accessToken` carries whatever
|
|
1335
|
+
* the provider's `buildCredentialsResponse` bundles (for Bluesky: the JSON
|
|
1336
|
+
* session bundle — the driver parses the `accessJwt` out of it, or reads the
|
|
1337
|
+
* top-level `accessJwt` from `providerMetadata`-adjacent fields). Everything
|
|
1338
|
+
* else the driver needs for routing (handle, pdsHost, did, …) is on
|
|
1339
|
+
* `providerMetadata`.
|
|
1340
|
+
*
|
|
1341
|
+
* Token refresh is delegated to connect (never done in-plugin) via the
|
|
1342
|
+
* per-account route `POST /agent/connect/{provider}/accounts/{accountIdentifier}/refresh`
|
|
1343
|
+
* — call `refreshSocialAccount(provider, accountIdentifier)`. (The non-account
|
|
1344
|
+
* `POST /agent/connect/{provider}/refresh` route refreshes the provider's
|
|
1345
|
+
* PRIMARY connection, which is wrong under multi-account Pattern A.)
|
|
1346
|
+
*/
|
|
1347
|
+
getSocialAccounts(provider: string): Promise<{
|
|
1348
|
+
provider: string;
|
|
1349
|
+
accounts: {
|
|
1350
|
+
connectionId: string;
|
|
1351
|
+
accountIdentifier: string;
|
|
1352
|
+
displayName: string | null;
|
|
1353
|
+
accessToken: string;
|
|
1354
|
+
providerMetadata: Record<string, unknown>;
|
|
1355
|
+
connectedAt: string;
|
|
1356
|
+
}[];
|
|
1357
|
+
}>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Pattern A: refresh a specific social Connection by its stable
|
|
1360
|
+
* `accountIdentifier` (for Bluesky: the account DID) via the
|
|
1361
|
+
* provider-generic per-account refresh route. The counterpart to
|
|
1362
|
+
* `getSocialAccounts(provider)`; `@alfe.ai/social-mcp` calls this on a
|
|
1363
|
+
* 401/ExpiredToken from the platform PDS/API, then re-fetches accounts to
|
|
1364
|
+
* pick up the rotated bundle.
|
|
1365
|
+
*
|
|
1366
|
+
* Refresh itself is ALWAYS delegated to connect — the plugin never calls
|
|
1367
|
+
* the platform's own refresh XRPC (e.g. `com.atproto.server.refreshSession`)
|
|
1368
|
+
* because connect owns the encrypted refresh token + rotation persistence
|
|
1369
|
+
* (Bluesky rotates the refreshJwt; a missed rotation kills the connection
|
|
1370
|
+
* after one refresh). The returned `accessToken` is whatever the provider's
|
|
1371
|
+
* `refreshToken` hook re-bundled (for Bluesky: the JSON session bundle with
|
|
1372
|
+
* the fresh `accessJwt`) — callers typically ignore it and re-fetch via
|
|
1373
|
+
* `getSocialAccounts` for a consistent shape.
|
|
1374
|
+
*/
|
|
1375
|
+
refreshSocialAccount(provider: string, accountIdentifier: string): Promise<{
|
|
1376
|
+
accountIdentifier: string;
|
|
1377
|
+
accessToken: string;
|
|
1378
|
+
accessTokenExpiresAt: string;
|
|
1379
|
+
expiresAt: string;
|
|
1380
|
+
}>;
|
|
1381
|
+
}
|
|
1382
|
+
//# sourceMappingURL=connect-credentials.d.ts.map
|
|
1383
|
+
//#endregion
|
|
1384
|
+
//#region src/domains/database.d.ts
|
|
1385
|
+
declare class DatabaseApi extends ApiBase {
|
|
1386
|
+
registerDatabaseCredentials(): Promise<{
|
|
1387
|
+
connectionString: string;
|
|
1388
|
+
username: string;
|
|
1389
|
+
password: string;
|
|
1390
|
+
databases: string[];
|
|
1391
|
+
}>;
|
|
1392
|
+
reportDatabaseAudit(entry: {
|
|
1393
|
+
database: string;
|
|
1394
|
+
collection: string;
|
|
1395
|
+
operation: string;
|
|
1396
|
+
summary?: string;
|
|
1397
|
+
}): Promise<void>;
|
|
1398
|
+
}
|
|
1399
|
+
//# sourceMappingURL=database.d.ts.map
|
|
1400
|
+
//#endregion
|
|
1401
|
+
//#region src/domains/identity.d.ts
|
|
1402
|
+
declare class IdentityApi extends ApiBase {
|
|
1403
|
+
/**
|
|
1404
|
+
* Returns the calling agent's own identity context — `{ agentId, tenantId }`
|
|
1405
|
+
* decoded server-side from the agent API token. Used by the
|
|
1406
|
+
* `@alfe.ai/openclaw-identity` plugin to bootstrap context when the
|
|
1407
|
+
* OpenClaw daemon doesn't plumb `ctx.agentId` through to plugin hooks.
|
|
1408
|
+
* Plugins should cache this for the daemon's lifetime (single-agent-per-
|
|
1409
|
+
* process invariant). One HTTP round-trip per process activate; not for
|
|
1410
|
+
* per-call use.
|
|
1411
|
+
*/
|
|
1412
|
+
whoami(): Promise<{
|
|
1413
|
+
agentId: string;
|
|
1414
|
+
tenantId: string;
|
|
1415
|
+
}>;
|
|
1416
|
+
resolveIdentity(args: {
|
|
1417
|
+
provider: string;
|
|
1418
|
+
platformId: string;
|
|
1419
|
+
kind?: "user" | "agent" | "service" | "bot" | "workspace";
|
|
1420
|
+
displayName?: string;
|
|
1421
|
+
}): Promise<{
|
|
1422
|
+
identityId: string | null;
|
|
1423
|
+
status: string;
|
|
1424
|
+
created?: boolean;
|
|
1425
|
+
reason?: string;
|
|
1426
|
+
/**
|
|
1427
|
+
* Flattened auriclabs permission strings for the resolved identity
|
|
1428
|
+
* (scope-prefixed where applicable). Empty array on miss / org service
|
|
1429
|
+
* outage — the runtime gate fails closed in that case.
|
|
1430
|
+
*/
|
|
1431
|
+
permissions: string[];
|
|
1432
|
+
}>;
|
|
1433
|
+
searchIdentities(args?: {
|
|
1434
|
+
q?: string;
|
|
1435
|
+
status?: string;
|
|
1436
|
+
limit?: number;
|
|
1437
|
+
}): Promise<{
|
|
1438
|
+
identities: unknown[];
|
|
1439
|
+
}>;
|
|
1440
|
+
getIdentityContext(identityId: string): Promise<{
|
|
1441
|
+
context: unknown;
|
|
1442
|
+
}>;
|
|
1443
|
+
mergeIdentities(survivorId: string, args: {
|
|
1444
|
+
mergedId: string;
|
|
1445
|
+
}): Promise<{
|
|
1446
|
+
ok: boolean;
|
|
1447
|
+
error?: string;
|
|
1448
|
+
}>;
|
|
1449
|
+
unmergeIdentity(identityId: string): Promise<{
|
|
1450
|
+
ok: boolean;
|
|
1451
|
+
error?: string;
|
|
1452
|
+
}>;
|
|
1453
|
+
addIdentityNote(identityId: string, args: {
|
|
1454
|
+
content: string;
|
|
1455
|
+
category?: string;
|
|
1456
|
+
}): Promise<{
|
|
1457
|
+
noteId: string | null;
|
|
1458
|
+
}>;
|
|
1459
|
+
tagIdentity(identityId: string, args: {
|
|
1460
|
+
tag: string;
|
|
1461
|
+
action: "add" | "remove";
|
|
1462
|
+
}): Promise<{
|
|
1463
|
+
ok: boolean;
|
|
1464
|
+
}>;
|
|
1465
|
+
getIdentityChangelog(identityId: string, args?: {
|
|
1466
|
+
limit?: number;
|
|
1467
|
+
cursor?: string;
|
|
1468
|
+
}): Promise<{
|
|
1469
|
+
entries: unknown[];
|
|
1470
|
+
cursor: string | null;
|
|
1471
|
+
}>;
|
|
1472
|
+
rollbackIdentity(identityId: string, args: {
|
|
1473
|
+
targetVersion: number;
|
|
1474
|
+
}): Promise<{
|
|
1475
|
+
ok: boolean;
|
|
1476
|
+
entry?: unknown;
|
|
1477
|
+
}>;
|
|
1478
|
+
requestIdentityVerification(args: {
|
|
1479
|
+
claimedIdentityId: string;
|
|
1480
|
+
requestingIdentityId: string;
|
|
1481
|
+
requestingProvider: string;
|
|
1482
|
+
requestingPlatformId: string;
|
|
1483
|
+
preferredChannel?: "mobile" | "email";
|
|
1484
|
+
/**
|
|
1485
|
+
* Phase 2: agent-supplied contact endpoint. When provided, the top-level
|
|
1486
|
+
* `preferredChannel` is ignored — the contact's channel wins.
|
|
1487
|
+
*/
|
|
1488
|
+
contact?: {
|
|
1489
|
+
channel: "email" | "mobile";
|
|
1490
|
+
value: string;
|
|
1491
|
+
};
|
|
1492
|
+
}): Promise<{
|
|
1493
|
+
verificationId: string;
|
|
1494
|
+
channel: string;
|
|
1495
|
+
deliveredTo: string;
|
|
1496
|
+
expiresAt: string;
|
|
1497
|
+
availableChannels: {
|
|
1498
|
+
channel: string;
|
|
1499
|
+
deliveredTo: string;
|
|
1500
|
+
}[];
|
|
1501
|
+
} | {
|
|
1502
|
+
error: string;
|
|
1503
|
+
}>;
|
|
1504
|
+
confirmIdentityVerification(args: {
|
|
1505
|
+
claimedIdentityId: string;
|
|
1506
|
+
verificationId: string;
|
|
1507
|
+
phrase: string;
|
|
1508
|
+
}): Promise<{
|
|
1509
|
+
verified: boolean;
|
|
1510
|
+
identityId?: string;
|
|
1511
|
+
/** Phase 2: how the confirm resolved — Scenario A vs B. */
|
|
1512
|
+
action?: "merged" | "contact_verified" | "already_confirmed";
|
|
1513
|
+
error?: string;
|
|
1514
|
+
}>;
|
|
1515
|
+
/**
|
|
1516
|
+
* Update display-shape fields on an Identity. Body excludes `email` /
|
|
1517
|
+
* `phone` / `title` / `company` / `metadata` per Section D4 — contacts go
|
|
1518
|
+
* via the verify flow, title/company live on OrgMembership, metadata is
|
|
1519
|
+
* not agent-writable.
|
|
1520
|
+
*/
|
|
1521
|
+
updateIdentity(identityId: string, args: {
|
|
1522
|
+
name?: string;
|
|
1523
|
+
avatarUrl?: string;
|
|
1524
|
+
timezone?: string;
|
|
1525
|
+
locale?: string;
|
|
1526
|
+
}): Promise<{
|
|
1527
|
+
ok: boolean;
|
|
1528
|
+
}>;
|
|
1529
|
+
/**
|
|
1530
|
+
* Phase 2 (Section H): server-side verification of a Google Chat sender via
|
|
1531
|
+
* the agent's existing Google OAuth credentials. Returns the resolved
|
|
1532
|
+
* identity (created or matched via Scenario-B email enrichment).
|
|
1533
|
+
*/
|
|
1534
|
+
resolveGoogleChatSender(args: {
|
|
1535
|
+
senderUserId: string;
|
|
1536
|
+
spaceId?: string;
|
|
1537
|
+
}): Promise<{
|
|
1538
|
+
identityId: string | null;
|
|
1539
|
+
status: string;
|
|
1540
|
+
}>;
|
|
1541
|
+
}
|
|
1542
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
1543
|
+
//#endregion
|
|
1544
|
+
//#region src/domains/images.d.ts
|
|
1545
|
+
declare class ImagesApi extends ApiBase {
|
|
1546
|
+
/**
|
|
1547
|
+
* Generate an image from a text prompt and get back a STABLE, public URL
|
|
1548
|
+
* (served from the agent-assets CDN — it does not expire). Embed the returned
|
|
1549
|
+
* `imageUrl` in a reply as markdown to show it to the user.
|
|
1550
|
+
*
|
|
1551
|
+
* ASYNC: `gpt-image-1` routinely runs 30–60s, which exceeds the API Gateway
|
|
1552
|
+
* 30s ceiling, so this enqueues a job (`POST /agent/images/generate` →
|
|
1553
|
+
* `jobId`) then polls (`GET /agent/images/{jobId}`) until it completes. The
|
|
1554
|
+
* worker's real failure message (e.g. an unsupported `size`) surfaces via the
|
|
1555
|
+
* job's `error` field.
|
|
1556
|
+
*/
|
|
1557
|
+
generateImage(args: {
|
|
1558
|
+
prompt: string;
|
|
1559
|
+
model?: string;
|
|
1560
|
+
size?: string;
|
|
1561
|
+
quality?: string;
|
|
1562
|
+
}): Promise<{
|
|
1563
|
+
imageUrl: string;
|
|
1564
|
+
model: string;
|
|
1565
|
+
}>;
|
|
1566
|
+
}
|
|
1567
|
+
//# sourceMappingURL=images.d.ts.map
|
|
1568
|
+
//#endregion
|
|
1569
|
+
//#region src/domains/integrations.d.ts
|
|
1570
|
+
declare class IntegrationsApi extends ApiBase {
|
|
1571
|
+
listIntegrations(): Promise<IntegrationInstall[]>;
|
|
1572
|
+
getIntegrationConfig(integrationId: string): Promise<IntegrationConfigResult>;
|
|
1573
|
+
updateIntegrationConfig(integrationId: string, config: Record<string, unknown>): Promise<void>;
|
|
1574
|
+
installIntegration(integrationId: string, options?: {
|
|
1575
|
+
version?: string;
|
|
1576
|
+
config?: Record<string, unknown>;
|
|
1577
|
+
}): Promise<IntegrationInstall>;
|
|
1578
|
+
removeIntegration(integrationId: string): Promise<IntegrationInstall>;
|
|
1579
|
+
getOAuthUrl(provider: string, scopes?: string[]): Promise<{
|
|
1580
|
+
url: string;
|
|
1581
|
+
provider: string;
|
|
1582
|
+
expiresIn: number;
|
|
1583
|
+
}>;
|
|
1584
|
+
getOAuthStatus(provider: string): Promise<{
|
|
1585
|
+
provider: string;
|
|
1586
|
+
connected: boolean;
|
|
1587
|
+
config?: Record<string, string>;
|
|
1588
|
+
}>;
|
|
1589
|
+
getRegistry(): Promise<{
|
|
1590
|
+
integrations: RegistryEntry[];
|
|
1591
|
+
}>;
|
|
1592
|
+
}
|
|
1593
|
+
//# sourceMappingURL=integrations.d.ts.map
|
|
1594
|
+
//#endregion
|
|
1595
|
+
//#region src/domains/memory.d.ts
|
|
1596
|
+
declare class MemoryApi extends ApiBase {
|
|
1597
|
+
memorySearch(query: string, opts?: {
|
|
1598
|
+
limit?: number;
|
|
1599
|
+
topic?: string;
|
|
1600
|
+
subtopic?: string;
|
|
1601
|
+
tag?: string;
|
|
1602
|
+
includeKnowledge?: boolean;
|
|
1603
|
+
}): Promise<{
|
|
1604
|
+
facts: {
|
|
1605
|
+
subject: string;
|
|
1606
|
+
predicate: string;
|
|
1607
|
+
object: string;
|
|
1608
|
+
since: string;
|
|
1609
|
+
confidence: number;
|
|
1610
|
+
}[];
|
|
1611
|
+
memories: {
|
|
1612
|
+
id: string;
|
|
1613
|
+
text: string;
|
|
1614
|
+
topic: string;
|
|
1615
|
+
subtopic: string;
|
|
1616
|
+
tag: string;
|
|
1617
|
+
importance: number;
|
|
1618
|
+
timestamp: number;
|
|
1619
|
+
score: number;
|
|
1620
|
+
}[];
|
|
1621
|
+
}>;
|
|
1622
|
+
memoryStore(text: string, opts?: {
|
|
1623
|
+
topic?: string;
|
|
1624
|
+
subtopic?: string;
|
|
1625
|
+
tag?: string;
|
|
1626
|
+
importance?: number;
|
|
1627
|
+
}): Promise<{
|
|
1628
|
+
memoryId: string;
|
|
1629
|
+
}>;
|
|
1630
|
+
memoryIngest(sessionKey: string, messages: {
|
|
1631
|
+
role: string;
|
|
1632
|
+
content: string;
|
|
1633
|
+
index: number;
|
|
1634
|
+
timestamp?: string;
|
|
1635
|
+
}[], metadata?: {
|
|
1636
|
+
channelId?: string;
|
|
1637
|
+
userId?: string;
|
|
1638
|
+
userName?: string;
|
|
1639
|
+
}, ingestEpoch?: number): Promise<{
|
|
1640
|
+
queued: boolean;
|
|
1641
|
+
messageCount: number;
|
|
1642
|
+
}>;
|
|
1643
|
+
memoryLoadContext(tier?: number, topicHint?: string): Promise<{
|
|
1644
|
+
tier: number;
|
|
1645
|
+
facts: {
|
|
1646
|
+
subject: string;
|
|
1647
|
+
predicate: string;
|
|
1648
|
+
object: string;
|
|
1649
|
+
since: string;
|
|
1650
|
+
}[];
|
|
1651
|
+
memories: {
|
|
1652
|
+
text: string;
|
|
1653
|
+
topic: string;
|
|
1654
|
+
subtopic: string;
|
|
1655
|
+
score: number;
|
|
1656
|
+
}[];
|
|
1657
|
+
tokenEstimate: number;
|
|
1658
|
+
formatted: string;
|
|
1659
|
+
}>;
|
|
1660
|
+
memoryLookupEntity(subject: string): Promise<{
|
|
1661
|
+
subject: string;
|
|
1662
|
+
triples: {
|
|
1663
|
+
tripleId: string;
|
|
1664
|
+
predicate: string;
|
|
1665
|
+
object: string;
|
|
1666
|
+
validFrom: string;
|
|
1667
|
+
validTo?: string;
|
|
1668
|
+
confidence: number;
|
|
1669
|
+
}[];
|
|
1670
|
+
}>;
|
|
1671
|
+
memoryNavigate(): Promise<{
|
|
1672
|
+
topics: {
|
|
1673
|
+
name: string;
|
|
1674
|
+
tripleCount: number;
|
|
1675
|
+
subtopics: string[];
|
|
1676
|
+
}[];
|
|
1677
|
+
cursor: string | null;
|
|
1678
|
+
}>;
|
|
1679
|
+
memoryDelete(memoryId: string): Promise<{
|
|
1680
|
+
deleted: boolean;
|
|
1681
|
+
}>;
|
|
1682
|
+
memoryStats(): Promise<{
|
|
1683
|
+
vectorCount: number;
|
|
1684
|
+
tripleCount: number;
|
|
1685
|
+
storageEstimateBytes: number;
|
|
1686
|
+
lastIngestionAt?: string;
|
|
1687
|
+
}>;
|
|
1688
|
+
memoryLearn(args: {
|
|
1689
|
+
text: string;
|
|
1690
|
+
source?: string;
|
|
1691
|
+
sourceType?: "file" | "url" | "inline";
|
|
1692
|
+
metadata?: {
|
|
1693
|
+
sessionId?: string;
|
|
1694
|
+
channelId?: string;
|
|
1695
|
+
userName?: string;
|
|
1696
|
+
};
|
|
1697
|
+
}): Promise<{
|
|
1698
|
+
memoriesStored: number;
|
|
1699
|
+
triplesStored: number;
|
|
1700
|
+
chunks: number;
|
|
1701
|
+
source?: string;
|
|
1702
|
+
}>;
|
|
1703
|
+
memoryBootstrapStatus(): Promise<{
|
|
1704
|
+
synced: boolean;
|
|
1705
|
+
syncedAt?: string;
|
|
1706
|
+
sessionsBackfillSynced?: boolean;
|
|
1707
|
+
sessionsBackfillSyncedAt?: string;
|
|
1708
|
+
}>;
|
|
1709
|
+
memoryBootstrapStatusMark(scope?: "files" | "sessions"): Promise<{
|
|
1710
|
+
synced: true;
|
|
1711
|
+
syncedAt: string;
|
|
1712
|
+
}>;
|
|
1713
|
+
}
|
|
1714
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
1715
|
+
//#endregion
|
|
1716
|
+
//#region src/domains/secrets.d.ts
|
|
1717
|
+
declare class SecretsApi extends ApiBase {
|
|
1718
|
+
/**
|
|
1719
|
+
* Mint a fresh AES-256 data key for a specific (secret, field) pair. The
|
|
1720
|
+
* encryption context is rebuilt server-side from `auth.tenantId` + the body
|
|
1721
|
+
* fields including `fieldKey`; the agent cannot forge context for a scope
|
|
1722
|
+
* or field it doesn't own. Legacy single-envelope secrets are migrated to
|
|
1723
|
+
* `field#value` rows by the data migration, so call with `fieldKey: "value"`
|
|
1724
|
+
* to reach them.
|
|
1725
|
+
*/
|
|
1726
|
+
generateSecretDataKey(args: {
|
|
1727
|
+
scope: SecretScope;
|
|
1728
|
+
scopeId: string;
|
|
1729
|
+
secretId: string;
|
|
1730
|
+
fieldKey: string;
|
|
1731
|
+
}): Promise<GeneratedDataKey>;
|
|
1732
|
+
/**
|
|
1733
|
+
* Unwrap a wrapped data key so the agent can decrypt the envelope locally.
|
|
1734
|
+
* `fieldKey` MUST match the value supplied when the data key was generated
|
|
1735
|
+
* (it's bound into KMS encryption context); mismatch fails with
|
|
1736
|
+
* `InvalidCiphertextException`.
|
|
1737
|
+
*/
|
|
1738
|
+
decryptSecretDataKey(args: {
|
|
1739
|
+
scope: SecretScope;
|
|
1740
|
+
scopeId: string;
|
|
1741
|
+
secretId: string;
|
|
1742
|
+
fieldKey: string;
|
|
1743
|
+
dataKeyCiphertext: string;
|
|
1744
|
+
}): Promise<{
|
|
1745
|
+
plaintextKey: string;
|
|
1746
|
+
}>;
|
|
1747
|
+
/**
|
|
1748
|
+
* Create a new secret with one or more fields. Encrypted fields must arrive
|
|
1749
|
+
* pre-sealed (the agent has already obtained per-field data keys via
|
|
1750
|
+
* `generateSecretDataKey({ ..., fieldKey })` and AES-encrypted locally).
|
|
1751
|
+
* Plaintext fields ship the value inline.
|
|
1752
|
+
*/
|
|
1753
|
+
createSecret(args: {
|
|
1754
|
+
scope: SecretScope;
|
|
1755
|
+
scopeId: string;
|
|
1756
|
+
secretId: string;
|
|
1757
|
+
secretName: string;
|
|
1758
|
+
category?: SecretCategory;
|
|
1759
|
+
description?: string;
|
|
1760
|
+
tags?: string[];
|
|
1761
|
+
fields: {
|
|
1762
|
+
key: string;
|
|
1763
|
+
format?: FieldFormat;
|
|
1764
|
+
sensitivity: FieldSensitivity;
|
|
1765
|
+
value?: string;
|
|
1766
|
+
envelope?: EncryptedEnvelopeV1;
|
|
1767
|
+
}[];
|
|
1768
|
+
reason?: string;
|
|
1769
|
+
}): Promise<SecretAggregate>;
|
|
1770
|
+
/** Fetch the secret aggregate plus per-field encrypted envelopes. */
|
|
1771
|
+
getSecret(args: {
|
|
1772
|
+
scope: SecretScope;
|
|
1773
|
+
scopeId: string;
|
|
1774
|
+
secretId: string;
|
|
1775
|
+
}): Promise<{
|
|
1776
|
+
aggregate: SecretAggregate;
|
|
1777
|
+
envelopes: FieldEnvelope[];
|
|
1778
|
+
}>;
|
|
1779
|
+
/** Fetch one field. Plaintext: value inline. Encrypted: envelope. */
|
|
1780
|
+
getSecretField(args: {
|
|
1781
|
+
scope: SecretScope;
|
|
1782
|
+
scopeId: string;
|
|
1783
|
+
secretId: string;
|
|
1784
|
+
fieldKey: string;
|
|
1785
|
+
}): Promise<{
|
|
1786
|
+
key: string;
|
|
1787
|
+
sensitivity: FieldSensitivity;
|
|
1788
|
+
format?: FieldFormat;
|
|
1789
|
+
value?: string;
|
|
1790
|
+
envelope?: EncryptedEnvelopeV1;
|
|
1791
|
+
rotatedAt?: string;
|
|
1792
|
+
createdAt: string;
|
|
1793
|
+
updatedAt: string;
|
|
1794
|
+
}>;
|
|
1795
|
+
/** Add OR rotate one field. */
|
|
1796
|
+
setSecretField(args: {
|
|
1797
|
+
scope: SecretScope;
|
|
1798
|
+
scopeId: string;
|
|
1799
|
+
secretId: string;
|
|
1800
|
+
fieldKey: string;
|
|
1801
|
+
sensitivity: FieldSensitivity;
|
|
1802
|
+
format?: FieldFormat;
|
|
1803
|
+
value?: string;
|
|
1804
|
+
envelope?: EncryptedEnvelopeV1;
|
|
1805
|
+
reason?: string;
|
|
1806
|
+
}): Promise<{
|
|
1807
|
+
fieldKey: string;
|
|
1808
|
+
rotated: boolean;
|
|
1809
|
+
}>;
|
|
1810
|
+
/** Remove one field. */
|
|
1811
|
+
removeSecretField(args: {
|
|
1812
|
+
scope: SecretScope;
|
|
1813
|
+
scopeId: string;
|
|
1814
|
+
secretId: string;
|
|
1815
|
+
fieldKey: string;
|
|
1816
|
+
}): Promise<void>;
|
|
1817
|
+
/** Update secret-level metadata (name/description/tags/category). */
|
|
1818
|
+
updateSecretMetadata(args: {
|
|
1819
|
+
scope: SecretScope;
|
|
1820
|
+
scopeId: string;
|
|
1821
|
+
secretId: string;
|
|
1822
|
+
secretName?: string;
|
|
1823
|
+
description?: string;
|
|
1824
|
+
tags?: string[];
|
|
1825
|
+
category?: SecretCategory;
|
|
1826
|
+
reason?: string;
|
|
1827
|
+
}): Promise<SecretAggregate>;
|
|
1828
|
+
/** List metadata for secrets in a scope. Optional filters route through the byFacet GSI. */
|
|
1829
|
+
listSecrets(args: {
|
|
1830
|
+
scope: SecretScope;
|
|
1831
|
+
scopeId: string;
|
|
1832
|
+
category?: SecretCategory;
|
|
1833
|
+
tag?: string;
|
|
1834
|
+
fieldKey?: string;
|
|
1835
|
+
}): Promise<SecretMetadata[]>;
|
|
1836
|
+
/** Bounded changelog read — metadata-only audit entries. */
|
|
1837
|
+
getSecretHistory(args: {
|
|
1838
|
+
scope: SecretScope;
|
|
1839
|
+
scopeId: string;
|
|
1840
|
+
secretId: string;
|
|
1841
|
+
limit?: number;
|
|
1842
|
+
cursor?: string;
|
|
1843
|
+
}): Promise<{
|
|
1844
|
+
entries: ChangelogEntry[];
|
|
1845
|
+
nextCursor?: string;
|
|
1846
|
+
}>;
|
|
1847
|
+
/** Delete a secret (and all its field rows + tag rows + changelog rows). */
|
|
1848
|
+
deleteSecret(args: {
|
|
1849
|
+
scope: SecretScope;
|
|
1850
|
+
scopeId: string;
|
|
1851
|
+
secretId: string;
|
|
1852
|
+
}): Promise<void>;
|
|
1853
|
+
/** Enumerate scopes (org/team/project/agent) this agent can access. */
|
|
1854
|
+
listSecretScopes(): Promise<ScopeInfo[]>;
|
|
1855
|
+
}
|
|
1856
|
+
//# sourceMappingURL=secrets.d.ts.map
|
|
1857
|
+
//#endregion
|
|
1858
|
+
//#region src/domains/teams.d.ts
|
|
1859
|
+
declare class TeamsApi extends ApiBase {
|
|
1860
|
+
getTeamsCredentials(): Promise<{
|
|
1861
|
+
agentId: string;
|
|
1862
|
+
tenantId: string;
|
|
1863
|
+
azureAppId: string;
|
|
1864
|
+
azureBotId: string;
|
|
1865
|
+
azureClientSecret: string;
|
|
1866
|
+
botDisplayName?: string;
|
|
1867
|
+
teamsTenantId?: string;
|
|
1868
|
+
serviceUrl?: string;
|
|
1869
|
+
}>;
|
|
1870
|
+
sendTeamsMessage(data: {
|
|
1871
|
+
conversationId: string;
|
|
1872
|
+
text?: string;
|
|
1873
|
+
adaptiveCard?: Record<string, unknown>;
|
|
1874
|
+
}): Promise<{
|
|
1875
|
+
ok: boolean;
|
|
1876
|
+
activityId: string;
|
|
1877
|
+
}>;
|
|
1878
|
+
listTeamsChannels(): Promise<{
|
|
1879
|
+
channels: {
|
|
1880
|
+
id: string;
|
|
1881
|
+
name: string;
|
|
1882
|
+
description?: string;
|
|
1883
|
+
}[];
|
|
1884
|
+
}>;
|
|
1885
|
+
}
|
|
1886
|
+
//# sourceMappingURL=teams.d.ts.map
|
|
1887
|
+
|
|
1888
|
+
//#endregion
|
|
1889
|
+
//#region src/index.d.ts
|
|
1890
|
+
interface AgentApiClient extends SyncApi, IntegrationsApi, WorkspaceApi, ConnectCredentialsApi, TeamsApi, ChatApi, SecretsApi, IdentityApi, MemoryApi, SearchApi, KnowledgeApi, DatabaseApi, MobileApi, RemoteApi, SelfApi, VoiceApi, ImagesApi, WebhooksApi {}
|
|
1891
|
+
declare class AgentApiClient extends ApiBase {
|
|
1892
|
+
constructor(config: AgentApiClientConfig);
|
|
1893
|
+
}
|
|
1894
|
+
//# sourceMappingURL=index.d.ts.map
|
|
1895
|
+
|
|
1896
|
+
//#endregion
|
|
1897
|
+
//#endregion
|
|
1898
|
+
//#region src/boundary.d.ts
|
|
1899
|
+
interface MicrosoftAccountInfo {
|
|
1900
|
+
connectionId: string;
|
|
1901
|
+
accountIdentifier: string;
|
|
1902
|
+
email: string;
|
|
1903
|
+
displayName?: string;
|
|
1904
|
+
connectedAt?: string;
|
|
1905
|
+
microsoftTenantId?: string;
|
|
1906
|
+
accessToken: string;
|
|
1907
|
+
accessTokenExpiresAt: string;
|
|
1908
|
+
}
|
|
1909
|
+
interface GraphRequestSpec {
|
|
1910
|
+
method: string;
|
|
1911
|
+
path: string;
|
|
1912
|
+
body?: unknown;
|
|
1913
|
+
}
|
|
1914
|
+
declare function parseCommand(command: string): GraphRequestSpec;
|
|
1915
|
+
declare function resolveGraphUrl(path: string): string;
|
|
1916
|
+
declare function tokenIsExpired(account: MicrosoftAccountInfo, now?: number): boolean;
|
|
1917
|
+
declare function safeErrorMessage(error: unknown, secrets?: string[]): string;
|
|
1918
|
+
//#endregion
|
|
1919
|
+
//#region src/server.d.ts
|
|
1920
|
+
declare const SERVER_VERSION: string;
|
|
1921
|
+
interface MicrosoftApiClient {
|
|
1922
|
+
getMicrosoftAccounts(): ReturnType<AgentApiClient["getMicrosoftAccounts"]>;
|
|
1923
|
+
refreshMicrosoftAccountToken(accountIdentifier: string): ReturnType<AgentApiClient["refreshMicrosoftAccountToken"]>;
|
|
1924
|
+
disconnectMicrosoftAccount(accountIdentifier: string): ReturnType<AgentApiClient["disconnectMicrosoftAccount"]>;
|
|
1925
|
+
}
|
|
1926
|
+
interface MicrosoftServerOptions {
|
|
1927
|
+
client?: MicrosoftApiClient;
|
|
1928
|
+
fetchImpl?: typeof fetch;
|
|
1929
|
+
now?: () => number;
|
|
1930
|
+
requestTimeoutMs?: number;
|
|
1931
|
+
}
|
|
1932
|
+
declare function createServer(options?: MicrosoftServerOptions): McpServer;
|
|
1933
|
+
declare function isProcessEntrypoint(argvPath: string | undefined, metaUrl: string): boolean;
|
|
1934
|
+
//#endregion
|
|
1935
|
+
export { type GraphRequestSpec, type MicrosoftAccountInfo, MicrosoftApiClient, MicrosoftServerOptions, SERVER_VERSION, createServer, isProcessEntrypoint, parseCommand, resolveGraphUrl, safeErrorMessage, tokenIsExpired };
|