@alfe.ai/microsoft-mcp 0.1.7 → 0.1.9

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,1966 @@
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
+ * The stable per-grant Connection key (`ctid:<userId>`) this account
1279
+ * belongs to. Every trading account under one cTrader login shares one
1280
+ * grant (one OAuth token), so this is the identifier the MCP server
1281
+ * passes to `refreshCTraderAccount()` to rotate the token for the whole
1282
+ * grant on a `CH_ACCESS_TOKEN_INVALID` expiry. Empty string when the
1283
+ * server did not supply one (legacy rows) — such an account can still
1284
+ * trade with its current token but cannot self-refresh.
1285
+ */
1286
+ accountIdentifier: string;
1287
+ }[];
1288
+ clientId: string;
1289
+ clientSecret: string;
1290
+ }>;
1291
+ /**
1292
+ * Pattern A: refresh a specific cTrader grant by its stable
1293
+ * `accountIdentifier` (`ctid:<userId>` from `getCTraderAccounts()`).
1294
+ *
1295
+ * cTrader access tokens live ~30 days; the `getCTraderAccounts()` /
1296
+ * credentials reads serve the STORED token without refreshing, so refresh is
1297
+ * the consumer's job. `@alfe.ai/ctrader-mcp` calls this when the cTrader Open
1298
+ * API rejects an account-auth with `CH_ACCESS_TOKEN_INVALID`, then re-runs
1299
+ * the socket handshake with the returned `accessToken`.
1300
+ *
1301
+ * Refreshing one grant rotates the single OAuth token that covers EVERY
1302
+ * trading account under that login. cTrader's refresh token itself does not
1303
+ * expire but may rotate on refresh (`rotatesRefreshToken: true`); connect
1304
+ * persists the rotated refresh token server-side, so the caller only needs
1305
+ * the new `accessToken`. Mirrors `refreshXeroAccountToken`.
1306
+ */
1307
+ refreshCTraderAccount(accountIdentifier: string): Promise<{
1308
+ accessToken: string;
1309
+ accessTokenExpiresAt: string;
1310
+ expiresAt: string;
1311
+ }>;
1312
+ /**
1313
+ * @deprecated Returns a single primary credential blob. Use
1314
+ * `getShopifyAccounts()` for the multi-account shape required by Pattern A
1315
+ * (`@alfe.ai/shopify-mcp` keys per-shop on the myshopify domain).
1316
+ */
1317
+ getShopifyCredentials(): Promise<{
1318
+ accessToken: string;
1319
+ shopDomain: string;
1320
+ shopGid: string;
1321
+ shopName: string;
1322
+ apiVersion: string;
1323
+ }>;
1324
+ /**
1325
+ * Pattern A: multi-account credential fetch for Shopify. Returns every
1326
+ * agent-scoped Shopify Connection. One OAuth grant maps to one store, so the
1327
+ * stable per-call selector is the store's myshopify domain (`shopDomain`),
1328
+ * NOT `accountIdentifier` — the connect provider keys `accountIdentifier` on
1329
+ * the immutable shop GID (falling back to the domain), so `shopDomain` is the
1330
+ * value the LLM passes and the plugin routes on.
1331
+ *
1332
+ * Each entry is shaped by the connect provider's `buildCredentialsResponse`:
1333
+ * `{ accessToken, shopDomain, shopGid, shopName, apiVersion }` — offline
1334
+ * Shopify tokens never expire, so there is NO token / expiry field and no
1335
+ * refresh method (unlike Salesforce). The GraphQL Admin API authenticates
1336
+ * purely on `X-Shopify-Access-Token`; no client credentials are on the wire.
1337
+ */
1338
+ getShopifyAccounts(): Promise<{
1339
+ accounts: {
1340
+ connectionId: string;
1341
+ accountIdentifier: string;
1342
+ displayName: string | null;
1343
+ connectedAt: string;
1344
+ accessToken: string;
1345
+ shopDomain: string;
1346
+ shopGid: string;
1347
+ shopName: string;
1348
+ apiVersion: string;
1349
+ }[];
1350
+ }>;
1351
+ /**
1352
+ * Pattern A: provider-parameterized multi-account credential fetch for the
1353
+ * social connectors (Bluesky, and the approval-gated backlog: X, Meta,
1354
+ * Threads, LinkedIn, Pinterest, TikTok, Reddit, YouTube).
1355
+ *
1356
+ * Unlike the bespoke `getGithubAccounts()` / `getXeroAccounts()` shapes,
1357
+ * this returns a UNIFORM normalized account shape so `@alfe.ai/social-mcp`'s
1358
+ * shared driver can require a single `account` selector on every
1359
+ * credential-touching tool regardless of platform. The backend
1360
+ * `api-agents/{provider}/accounts` route is already provider-generic; this
1361
+ * is the client-side normalization the plan (`do-we-need-any-moonlit-toucan`
1362
+ * Phase 0, step 5) calls for.
1363
+ *
1364
+ * `accountIdentifier` is the stable per-account selector the LLM should
1365
+ * pass back (for Bluesky: the account DID). `accessToken` carries whatever
1366
+ * the provider's `buildCredentialsResponse` bundles (for Bluesky: the JSON
1367
+ * session bundle — the driver parses the `accessJwt` out of it, or reads the
1368
+ * top-level `accessJwt` from `providerMetadata`-adjacent fields). Everything
1369
+ * else the driver needs for routing (handle, pdsHost, did, …) is on
1370
+ * `providerMetadata`.
1371
+ *
1372
+ * Token refresh is delegated to connect (never done in-plugin) via the
1373
+ * per-account route `POST /agent/connect/{provider}/accounts/{accountIdentifier}/refresh`
1374
+ * — call `refreshSocialAccount(provider, accountIdentifier)`. (The non-account
1375
+ * `POST /agent/connect/{provider}/refresh` route refreshes the provider's
1376
+ * PRIMARY connection, which is wrong under multi-account Pattern A.)
1377
+ */
1378
+ getSocialAccounts(provider: string): Promise<{
1379
+ provider: string;
1380
+ accounts: {
1381
+ connectionId: string;
1382
+ accountIdentifier: string;
1383
+ displayName: string | null;
1384
+ accessToken: string;
1385
+ providerMetadata: Record<string, unknown>;
1386
+ connectedAt: string;
1387
+ }[];
1388
+ }>;
1389
+ /**
1390
+ * Pattern A: refresh a specific social Connection by its stable
1391
+ * `accountIdentifier` (for Bluesky: the account DID) via the
1392
+ * provider-generic per-account refresh route. The counterpart to
1393
+ * `getSocialAccounts(provider)`; `@alfe.ai/social-mcp` calls this on a
1394
+ * 401/ExpiredToken from the platform PDS/API, then re-fetches accounts to
1395
+ * pick up the rotated bundle.
1396
+ *
1397
+ * Refresh itself is ALWAYS delegated to connect — the plugin never calls
1398
+ * the platform's own refresh XRPC (e.g. `com.atproto.server.refreshSession`)
1399
+ * because connect owns the encrypted refresh token + rotation persistence
1400
+ * (Bluesky rotates the refreshJwt; a missed rotation kills the connection
1401
+ * after one refresh). The returned `accessToken` is whatever the provider's
1402
+ * `refreshToken` hook re-bundled (for Bluesky: the JSON session bundle with
1403
+ * the fresh `accessJwt`) — callers typically ignore it and re-fetch via
1404
+ * `getSocialAccounts` for a consistent shape.
1405
+ */
1406
+ refreshSocialAccount(provider: string, accountIdentifier: string): Promise<{
1407
+ accountIdentifier: string;
1408
+ accessToken: string;
1409
+ accessTokenExpiresAt: string;
1410
+ expiresAt: string;
1411
+ }>;
1412
+ }
1413
+ //# sourceMappingURL=connect-credentials.d.ts.map
1414
+ //#endregion
1415
+ //#region src/domains/database.d.ts
1416
+ declare class DatabaseApi extends ApiBase {
1417
+ registerDatabaseCredentials(): Promise<{
1418
+ connectionString: string;
1419
+ username: string;
1420
+ password: string;
1421
+ databases: string[];
1422
+ }>;
1423
+ reportDatabaseAudit(entry: {
1424
+ database: string;
1425
+ collection: string;
1426
+ operation: string;
1427
+ summary?: string;
1428
+ }): Promise<void>;
1429
+ }
1430
+ //# sourceMappingURL=database.d.ts.map
1431
+ //#endregion
1432
+ //#region src/domains/identity.d.ts
1433
+ declare class IdentityApi extends ApiBase {
1434
+ /**
1435
+ * Returns the calling agent's own identity context — `{ agentId, tenantId }`
1436
+ * decoded server-side from the agent API token. Used by the
1437
+ * `@alfe.ai/openclaw-identity` plugin to bootstrap context when the
1438
+ * OpenClaw daemon doesn't plumb `ctx.agentId` through to plugin hooks.
1439
+ * Plugins should cache this for the daemon's lifetime (single-agent-per-
1440
+ * process invariant). One HTTP round-trip per process activate; not for
1441
+ * per-call use.
1442
+ */
1443
+ whoami(): Promise<{
1444
+ agentId: string;
1445
+ tenantId: string;
1446
+ }>;
1447
+ resolveIdentity(args: {
1448
+ provider: string;
1449
+ platformId: string;
1450
+ kind?: "user" | "agent" | "service" | "bot" | "workspace";
1451
+ displayName?: string;
1452
+ }): Promise<{
1453
+ identityId: string | null;
1454
+ status: string;
1455
+ created?: boolean;
1456
+ reason?: string;
1457
+ /**
1458
+ * Flattened auriclabs permission strings for the resolved identity
1459
+ * (scope-prefixed where applicable). Empty array on miss / org service
1460
+ * outage — the runtime gate fails closed in that case.
1461
+ */
1462
+ permissions: string[];
1463
+ }>;
1464
+ searchIdentities(args?: {
1465
+ q?: string;
1466
+ status?: string;
1467
+ limit?: number;
1468
+ }): Promise<{
1469
+ identities: unknown[];
1470
+ }>;
1471
+ getIdentityContext(identityId: string): Promise<{
1472
+ context: unknown;
1473
+ }>;
1474
+ mergeIdentities(survivorId: string, args: {
1475
+ mergedId: string;
1476
+ }): Promise<{
1477
+ ok: boolean;
1478
+ error?: string;
1479
+ }>;
1480
+ unmergeIdentity(identityId: string): Promise<{
1481
+ ok: boolean;
1482
+ error?: string;
1483
+ }>;
1484
+ addIdentityNote(identityId: string, args: {
1485
+ content: string;
1486
+ category?: string;
1487
+ }): Promise<{
1488
+ noteId: string | null;
1489
+ }>;
1490
+ tagIdentity(identityId: string, args: {
1491
+ tag: string;
1492
+ action: "add" | "remove";
1493
+ }): Promise<{
1494
+ ok: boolean;
1495
+ }>;
1496
+ getIdentityChangelog(identityId: string, args?: {
1497
+ limit?: number;
1498
+ cursor?: string;
1499
+ }): Promise<{
1500
+ entries: unknown[];
1501
+ cursor: string | null;
1502
+ }>;
1503
+ rollbackIdentity(identityId: string, args: {
1504
+ targetVersion: number;
1505
+ }): Promise<{
1506
+ ok: boolean;
1507
+ entry?: unknown;
1508
+ }>;
1509
+ requestIdentityVerification(args: {
1510
+ claimedIdentityId: string;
1511
+ requestingIdentityId: string;
1512
+ requestingProvider: string;
1513
+ requestingPlatformId: string;
1514
+ preferredChannel?: "mobile" | "email";
1515
+ /**
1516
+ * Phase 2: agent-supplied contact endpoint. When provided, the top-level
1517
+ * `preferredChannel` is ignored — the contact's channel wins.
1518
+ */
1519
+ contact?: {
1520
+ channel: "email" | "mobile";
1521
+ value: string;
1522
+ };
1523
+ }): Promise<{
1524
+ verificationId: string;
1525
+ channel: string;
1526
+ deliveredTo: string;
1527
+ expiresAt: string;
1528
+ availableChannels: {
1529
+ channel: string;
1530
+ deliveredTo: string;
1531
+ }[];
1532
+ } | {
1533
+ error: string;
1534
+ }>;
1535
+ confirmIdentityVerification(args: {
1536
+ claimedIdentityId: string;
1537
+ verificationId: string;
1538
+ phrase: string;
1539
+ }): Promise<{
1540
+ verified: boolean;
1541
+ identityId?: string;
1542
+ /** Phase 2: how the confirm resolved — Scenario A vs B. */
1543
+ action?: "merged" | "contact_verified" | "already_confirmed";
1544
+ error?: string;
1545
+ }>;
1546
+ /**
1547
+ * Update display-shape fields on an Identity. Body excludes `email` /
1548
+ * `phone` / `title` / `company` / `metadata` per Section D4 — contacts go
1549
+ * via the verify flow, title/company live on OrgMembership, metadata is
1550
+ * not agent-writable.
1551
+ */
1552
+ updateIdentity(identityId: string, args: {
1553
+ name?: string;
1554
+ avatarUrl?: string;
1555
+ timezone?: string;
1556
+ locale?: string;
1557
+ }): Promise<{
1558
+ ok: boolean;
1559
+ }>;
1560
+ /**
1561
+ * Phase 2 (Section H): server-side verification of a Google Chat sender via
1562
+ * the agent's existing Google OAuth credentials. Returns the resolved
1563
+ * identity (created or matched via Scenario-B email enrichment).
1564
+ */
1565
+ resolveGoogleChatSender(args: {
1566
+ senderUserId: string;
1567
+ spaceId?: string;
1568
+ }): Promise<{
1569
+ identityId: string | null;
1570
+ status: string;
1571
+ }>;
1572
+ }
1573
+ //# sourceMappingURL=identity.d.ts.map
1574
+ //#endregion
1575
+ //#region src/domains/images.d.ts
1576
+ declare class ImagesApi extends ApiBase {
1577
+ /**
1578
+ * Generate an image from a text prompt and get back a STABLE, public URL
1579
+ * (served from the agent-assets CDN — it does not expire). Embed the returned
1580
+ * `imageUrl` in a reply as markdown to show it to the user.
1581
+ *
1582
+ * ASYNC: `gpt-image-1` routinely runs 30–60s, which exceeds the API Gateway
1583
+ * 30s ceiling, so this enqueues a job (`POST /agent/images/generate` →
1584
+ * `jobId`) then polls (`GET /agent/images/{jobId}`) until it completes. The
1585
+ * worker's real failure message (e.g. an unsupported `size`) surfaces via the
1586
+ * job's `error` field.
1587
+ */
1588
+ generateImage(args: {
1589
+ prompt: string;
1590
+ model?: string;
1591
+ size?: string;
1592
+ quality?: string;
1593
+ }): Promise<{
1594
+ imageUrl: string;
1595
+ model: string;
1596
+ }>;
1597
+ }
1598
+ //# sourceMappingURL=images.d.ts.map
1599
+ //#endregion
1600
+ //#region src/domains/integrations.d.ts
1601
+ declare class IntegrationsApi extends ApiBase {
1602
+ listIntegrations(): Promise<IntegrationInstall[]>;
1603
+ getIntegrationConfig(integrationId: string): Promise<IntegrationConfigResult>;
1604
+ updateIntegrationConfig(integrationId: string, config: Record<string, unknown>): Promise<void>;
1605
+ installIntegration(integrationId: string, options?: {
1606
+ version?: string;
1607
+ config?: Record<string, unknown>;
1608
+ }): Promise<IntegrationInstall>;
1609
+ removeIntegration(integrationId: string): Promise<IntegrationInstall>;
1610
+ getOAuthUrl(provider: string, scopes?: string[]): Promise<{
1611
+ url: string;
1612
+ provider: string;
1613
+ expiresIn: number;
1614
+ }>;
1615
+ getOAuthStatus(provider: string): Promise<{
1616
+ provider: string;
1617
+ connected: boolean;
1618
+ config?: Record<string, string>;
1619
+ }>;
1620
+ getRegistry(): Promise<{
1621
+ integrations: RegistryEntry[];
1622
+ }>;
1623
+ }
1624
+ //# sourceMappingURL=integrations.d.ts.map
1625
+ //#endregion
1626
+ //#region src/domains/memory.d.ts
1627
+ declare class MemoryApi extends ApiBase {
1628
+ memorySearch(query: string, opts?: {
1629
+ limit?: number;
1630
+ topic?: string;
1631
+ subtopic?: string;
1632
+ tag?: string;
1633
+ includeKnowledge?: boolean;
1634
+ }): Promise<{
1635
+ facts: {
1636
+ subject: string;
1637
+ predicate: string;
1638
+ object: string;
1639
+ since: string;
1640
+ confidence: number;
1641
+ }[];
1642
+ memories: {
1643
+ id: string;
1644
+ text: string;
1645
+ topic: string;
1646
+ subtopic: string;
1647
+ tag: string;
1648
+ importance: number;
1649
+ timestamp: number;
1650
+ score: number;
1651
+ }[];
1652
+ }>;
1653
+ memoryStore(text: string, opts?: {
1654
+ topic?: string;
1655
+ subtopic?: string;
1656
+ tag?: string;
1657
+ importance?: number;
1658
+ }): Promise<{
1659
+ memoryId: string;
1660
+ }>;
1661
+ memoryIngest(sessionKey: string, messages: {
1662
+ role: string;
1663
+ content: string;
1664
+ index: number;
1665
+ timestamp?: string;
1666
+ }[], metadata?: {
1667
+ channelId?: string;
1668
+ userId?: string;
1669
+ userName?: string;
1670
+ }, ingestEpoch?: number): Promise<{
1671
+ queued: boolean;
1672
+ messageCount: number;
1673
+ }>;
1674
+ memoryLoadContext(tier?: number, topicHint?: string): Promise<{
1675
+ tier: number;
1676
+ facts: {
1677
+ subject: string;
1678
+ predicate: string;
1679
+ object: string;
1680
+ since: string;
1681
+ }[];
1682
+ memories: {
1683
+ text: string;
1684
+ topic: string;
1685
+ subtopic: string;
1686
+ score: number;
1687
+ }[];
1688
+ tokenEstimate: number;
1689
+ formatted: string;
1690
+ }>;
1691
+ memoryLookupEntity(subject: string): Promise<{
1692
+ subject: string;
1693
+ triples: {
1694
+ tripleId: string;
1695
+ predicate: string;
1696
+ object: string;
1697
+ validFrom: string;
1698
+ validTo?: string;
1699
+ confidence: number;
1700
+ }[];
1701
+ }>;
1702
+ memoryNavigate(): Promise<{
1703
+ topics: {
1704
+ name: string;
1705
+ tripleCount: number;
1706
+ subtopics: string[];
1707
+ }[];
1708
+ cursor: string | null;
1709
+ }>;
1710
+ memoryDelete(memoryId: string): Promise<{
1711
+ deleted: boolean;
1712
+ }>;
1713
+ memoryStats(): Promise<{
1714
+ vectorCount: number;
1715
+ tripleCount: number;
1716
+ storageEstimateBytes: number;
1717
+ lastIngestionAt?: string;
1718
+ }>;
1719
+ memoryLearn(args: {
1720
+ text: string;
1721
+ source?: string;
1722
+ sourceType?: "file" | "url" | "inline";
1723
+ metadata?: {
1724
+ sessionId?: string;
1725
+ channelId?: string;
1726
+ userName?: string;
1727
+ };
1728
+ }): Promise<{
1729
+ memoriesStored: number;
1730
+ triplesStored: number;
1731
+ chunks: number;
1732
+ source?: string;
1733
+ }>;
1734
+ memoryBootstrapStatus(): Promise<{
1735
+ synced: boolean;
1736
+ syncedAt?: string;
1737
+ sessionsBackfillSynced?: boolean;
1738
+ sessionsBackfillSyncedAt?: string;
1739
+ }>;
1740
+ memoryBootstrapStatusMark(scope?: "files" | "sessions"): Promise<{
1741
+ synced: true;
1742
+ syncedAt: string;
1743
+ }>;
1744
+ }
1745
+ //# sourceMappingURL=memory.d.ts.map
1746
+ //#endregion
1747
+ //#region src/domains/secrets.d.ts
1748
+ declare class SecretsApi extends ApiBase {
1749
+ /**
1750
+ * Mint a fresh AES-256 data key for a specific (secret, field) pair. The
1751
+ * encryption context is rebuilt server-side from `auth.tenantId` + the body
1752
+ * fields including `fieldKey`; the agent cannot forge context for a scope
1753
+ * or field it doesn't own. Legacy single-envelope secrets are migrated to
1754
+ * `field#value` rows by the data migration, so call with `fieldKey: "value"`
1755
+ * to reach them.
1756
+ */
1757
+ generateSecretDataKey(args: {
1758
+ scope: SecretScope;
1759
+ scopeId: string;
1760
+ secretId: string;
1761
+ fieldKey: string;
1762
+ }): Promise<GeneratedDataKey>;
1763
+ /**
1764
+ * Unwrap a wrapped data key so the agent can decrypt the envelope locally.
1765
+ * `fieldKey` MUST match the value supplied when the data key was generated
1766
+ * (it's bound into KMS encryption context); mismatch fails with
1767
+ * `InvalidCiphertextException`.
1768
+ */
1769
+ decryptSecretDataKey(args: {
1770
+ scope: SecretScope;
1771
+ scopeId: string;
1772
+ secretId: string;
1773
+ fieldKey: string;
1774
+ dataKeyCiphertext: string;
1775
+ }): Promise<{
1776
+ plaintextKey: string;
1777
+ }>;
1778
+ /**
1779
+ * Create a new secret with one or more fields. Encrypted fields must arrive
1780
+ * pre-sealed (the agent has already obtained per-field data keys via
1781
+ * `generateSecretDataKey({ ..., fieldKey })` and AES-encrypted locally).
1782
+ * Plaintext fields ship the value inline.
1783
+ */
1784
+ createSecret(args: {
1785
+ scope: SecretScope;
1786
+ scopeId: string;
1787
+ secretId: string;
1788
+ secretName: string;
1789
+ category?: SecretCategory;
1790
+ description?: string;
1791
+ tags?: string[];
1792
+ fields: {
1793
+ key: string;
1794
+ format?: FieldFormat;
1795
+ sensitivity: FieldSensitivity;
1796
+ value?: string;
1797
+ envelope?: EncryptedEnvelopeV1;
1798
+ }[];
1799
+ reason?: string;
1800
+ }): Promise<SecretAggregate>;
1801
+ /** Fetch the secret aggregate plus per-field encrypted envelopes. */
1802
+ getSecret(args: {
1803
+ scope: SecretScope;
1804
+ scopeId: string;
1805
+ secretId: string;
1806
+ }): Promise<{
1807
+ aggregate: SecretAggregate;
1808
+ envelopes: FieldEnvelope[];
1809
+ }>;
1810
+ /** Fetch one field. Plaintext: value inline. Encrypted: envelope. */
1811
+ getSecretField(args: {
1812
+ scope: SecretScope;
1813
+ scopeId: string;
1814
+ secretId: string;
1815
+ fieldKey: string;
1816
+ }): Promise<{
1817
+ key: string;
1818
+ sensitivity: FieldSensitivity;
1819
+ format?: FieldFormat;
1820
+ value?: string;
1821
+ envelope?: EncryptedEnvelopeV1;
1822
+ rotatedAt?: string;
1823
+ createdAt: string;
1824
+ updatedAt: string;
1825
+ }>;
1826
+ /** Add OR rotate one field. */
1827
+ setSecretField(args: {
1828
+ scope: SecretScope;
1829
+ scopeId: string;
1830
+ secretId: string;
1831
+ fieldKey: string;
1832
+ sensitivity: FieldSensitivity;
1833
+ format?: FieldFormat;
1834
+ value?: string;
1835
+ envelope?: EncryptedEnvelopeV1;
1836
+ reason?: string;
1837
+ }): Promise<{
1838
+ fieldKey: string;
1839
+ rotated: boolean;
1840
+ }>;
1841
+ /** Remove one field. */
1842
+ removeSecretField(args: {
1843
+ scope: SecretScope;
1844
+ scopeId: string;
1845
+ secretId: string;
1846
+ fieldKey: string;
1847
+ }): Promise<void>;
1848
+ /** Update secret-level metadata (name/description/tags/category). */
1849
+ updateSecretMetadata(args: {
1850
+ scope: SecretScope;
1851
+ scopeId: string;
1852
+ secretId: string;
1853
+ secretName?: string;
1854
+ description?: string;
1855
+ tags?: string[];
1856
+ category?: SecretCategory;
1857
+ reason?: string;
1858
+ }): Promise<SecretAggregate>;
1859
+ /** List metadata for secrets in a scope. Optional filters route through the byFacet GSI. */
1860
+ listSecrets(args: {
1861
+ scope: SecretScope;
1862
+ scopeId: string;
1863
+ category?: SecretCategory;
1864
+ tag?: string;
1865
+ fieldKey?: string;
1866
+ }): Promise<SecretMetadata[]>;
1867
+ /** Bounded changelog read — metadata-only audit entries. */
1868
+ getSecretHistory(args: {
1869
+ scope: SecretScope;
1870
+ scopeId: string;
1871
+ secretId: string;
1872
+ limit?: number;
1873
+ cursor?: string;
1874
+ }): Promise<{
1875
+ entries: ChangelogEntry[];
1876
+ nextCursor?: string;
1877
+ }>;
1878
+ /** Delete a secret (and all its field rows + tag rows + changelog rows). */
1879
+ deleteSecret(args: {
1880
+ scope: SecretScope;
1881
+ scopeId: string;
1882
+ secretId: string;
1883
+ }): Promise<void>;
1884
+ /** Enumerate scopes (org/team/project/agent) this agent can access. */
1885
+ listSecretScopes(): Promise<ScopeInfo[]>;
1886
+ }
1887
+ //# sourceMappingURL=secrets.d.ts.map
1888
+ //#endregion
1889
+ //#region src/domains/teams.d.ts
1890
+ declare class TeamsApi extends ApiBase {
1891
+ getTeamsCredentials(): Promise<{
1892
+ agentId: string;
1893
+ tenantId: string;
1894
+ azureAppId: string;
1895
+ azureBotId: string;
1896
+ azureClientSecret: string;
1897
+ botDisplayName?: string;
1898
+ teamsTenantId?: string;
1899
+ serviceUrl?: string;
1900
+ }>;
1901
+ sendTeamsMessage(data: {
1902
+ conversationId: string;
1903
+ text?: string;
1904
+ adaptiveCard?: Record<string, unknown>;
1905
+ }): Promise<{
1906
+ ok: boolean;
1907
+ activityId: string;
1908
+ }>;
1909
+ listTeamsChannels(): Promise<{
1910
+ channels: {
1911
+ id: string;
1912
+ name: string;
1913
+ description?: string;
1914
+ }[];
1915
+ }>;
1916
+ }
1917
+ //# sourceMappingURL=teams.d.ts.map
1918
+
1919
+ //#endregion
1920
+ //#region src/index.d.ts
1921
+ interface AgentApiClient extends SyncApi, IntegrationsApi, WorkspaceApi, ConnectCredentialsApi, TeamsApi, ChatApi, SecretsApi, IdentityApi, MemoryApi, SearchApi, KnowledgeApi, DatabaseApi, MobileApi, RemoteApi, SelfApi, VoiceApi, ImagesApi, WebhooksApi {}
1922
+ declare class AgentApiClient extends ApiBase {
1923
+ constructor(config: AgentApiClientConfig);
1924
+ }
1925
+ //# sourceMappingURL=index.d.ts.map
1926
+
1927
+ //#endregion
1928
+ //#endregion
1929
+ //#region src/boundary.d.ts
1930
+ interface MicrosoftAccountInfo {
1931
+ connectionId: string;
1932
+ accountIdentifier: string;
1933
+ email: string;
1934
+ displayName?: string;
1935
+ connectedAt?: string;
1936
+ microsoftTenantId?: string;
1937
+ accessToken: string;
1938
+ accessTokenExpiresAt: string;
1939
+ }
1940
+ interface GraphRequestSpec {
1941
+ method: string;
1942
+ path: string;
1943
+ body?: unknown;
1944
+ }
1945
+ declare function parseCommand(command: string): GraphRequestSpec;
1946
+ declare function resolveGraphUrl(path: string): string;
1947
+ declare function tokenIsExpired(account: MicrosoftAccountInfo, now?: number): boolean;
1948
+ declare function safeErrorMessage(error: unknown, secrets?: string[]): string;
1949
+ //#endregion
1950
+ //#region src/server.d.ts
1951
+ declare const SERVER_VERSION: string;
1952
+ interface MicrosoftApiClient {
1953
+ getMicrosoftAccounts(): ReturnType<AgentApiClient["getMicrosoftAccounts"]>;
1954
+ refreshMicrosoftAccountToken(accountIdentifier: string): ReturnType<AgentApiClient["refreshMicrosoftAccountToken"]>;
1955
+ disconnectMicrosoftAccount(accountIdentifier: string): ReturnType<AgentApiClient["disconnectMicrosoftAccount"]>;
1956
+ }
1957
+ interface MicrosoftServerOptions {
1958
+ client?: MicrosoftApiClient;
1959
+ fetchImpl?: typeof fetch;
1960
+ now?: () => number;
1961
+ requestTimeoutMs?: number;
1962
+ }
1963
+ declare function createServer(options?: MicrosoftServerOptions): McpServer;
1964
+ declare function isProcessEntrypoint(argvPath: string | undefined, metaUrl: string): boolean;
1965
+ //#endregion
1966
+ export { type GraphRequestSpec, type MicrosoftAccountInfo, MicrosoftApiClient, MicrosoftServerOptions, SERVER_VERSION, createServer, isProcessEntrypoint, parseCommand, resolveGraphUrl, safeErrorMessage, tokenIsExpired };