@alfe.ai/microsoft-mcp 0.1.12 → 0.1.14

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