@alfe.ai/agent-api-client 0.0.12 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,5 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/index.ts
3
+ /**
4
+ * Encode each path segment but keep the `/` separators — `encodeURIComponent`
5
+ * would escape the slashes too, breaking greedy proxy routes.
6
+ */
7
+ function encodeFilePath(filePath) {
8
+ return filePath.split("/").map(encodeURIComponent).join("/");
9
+ }
3
10
  var AgentApiClient = class {
4
11
  apiKey;
5
12
  apiUrl;
@@ -22,6 +29,57 @@ var AgentApiClient = class {
22
29
  }
23
30
  return (await res.json()).data;
24
31
  }
32
+ async syncRegister(args) {
33
+ return this.request("/agents/sync/register", {
34
+ method: "POST",
35
+ body: JSON.stringify(args ?? {})
36
+ });
37
+ }
38
+ async syncGetManifest() {
39
+ return this.request("/agents/sync/manifest");
40
+ }
41
+ async syncPresign(args) {
42
+ return this.request("/agents/sync/presign", {
43
+ method: "POST",
44
+ body: JSON.stringify(args)
45
+ });
46
+ }
47
+ async syncConfirmUpload(args) {
48
+ return this.request("/agents/sync/confirm", {
49
+ method: "POST",
50
+ body: JSON.stringify(args)
51
+ });
52
+ }
53
+ async syncReconstruct(args) {
54
+ return this.request("/agents/sync/reconstruct", {
55
+ method: "POST",
56
+ body: JSON.stringify(args)
57
+ });
58
+ }
59
+ async syncGetStats() {
60
+ return this.request("/agents/sync/stats");
61
+ }
62
+ async syncListFiles(args) {
63
+ const qs = new URLSearchParams();
64
+ if (args?.prefix) qs.set("prefix", args.prefix);
65
+ const query = qs.toString();
66
+ return this.request(`/agents/sync/files${query ? `?${query}` : ""}`);
67
+ }
68
+ async syncListSessions() {
69
+ return this.request("/agents/sync/sessions");
70
+ }
71
+ async syncGetSession(sessionId) {
72
+ return this.request(`/agents/sync/sessions/${encodeURIComponent(sessionId)}`);
73
+ }
74
+ async syncDeleteFile(filePath) {
75
+ return this.request(`/agents/sync/files/${encodeFilePath(filePath)}`, { method: "DELETE" });
76
+ }
77
+ async sharedListFiles(args) {
78
+ return this.request(`/agents/org/files/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}`);
79
+ }
80
+ async sharedDownloadUrl(args) {
81
+ return this.request(`/agents/org/files/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/download/${encodeFilePath(args.filePath)}`);
82
+ }
25
83
  async listIntegrations() {
26
84
  return this.request("/agent/integrations");
27
85
  }
@@ -170,26 +228,11 @@ var AgentApiClient = class {
170
228
  body: JSON.stringify(args)
171
229
  });
172
230
  }
173
- async enforcePolicy(args) {
174
- return this.request("/agent/identity/enforce", {
175
- method: "POST",
176
- body: JSON.stringify(args)
177
- });
178
- }
179
- async checkToolPermission(args) {
180
- return this.request("/agent/identity/check-tool", {
181
- method: "POST",
182
- body: JSON.stringify(args)
183
- });
184
- }
185
231
  async searchIdentities(args) {
186
232
  const qs = new URLSearchParams();
187
233
  if (args?.q) qs.set("q", args.q);
188
234
  if (args?.status) qs.set("status", args.status);
189
- if (args?.tag) qs.set("tag", args.tag);
190
- if (args?.platform) qs.set("platform", args.platform);
191
235
  if (args?.limit) qs.set("limit", String(args.limit));
192
- if (args?.offset) qs.set("offset", String(args.offset));
193
236
  const query = qs.toString();
194
237
  return this.request(`/agent/identity/search${query ? `?${query}` : ""}`);
195
238
  }
@@ -223,7 +266,6 @@ var AgentApiClient = class {
223
266
  async getIdentityChangelog(identityId, args) {
224
267
  const qs = new URLSearchParams();
225
268
  if (args?.limit) qs.set("limit", String(args.limit));
226
- if (args?.offset) qs.set("offset", String(args.offset));
227
269
  const query = qs.toString();
228
270
  return this.request(`/agent/identity/${encodeURIComponent(identityId)}/changelog${query ? `?${query}` : ""}`);
229
271
  }
@@ -245,6 +287,29 @@ var AgentApiClient = class {
245
287
  body: JSON.stringify(args)
246
288
  });
247
289
  }
290
+ /**
291
+ * Update display-shape fields on an Identity. Body excludes `email` /
292
+ * `phone` / `title` / `company` / `metadata` per Section D4 — contacts go
293
+ * via the verify flow, title/company live on OrgMembership, metadata is
294
+ * not agent-writable.
295
+ */
296
+ async updateIdentity(identityId, args) {
297
+ return this.request(`/agent/identity/${encodeURIComponent(identityId)}/update`, {
298
+ method: "POST",
299
+ body: JSON.stringify(args)
300
+ });
301
+ }
302
+ /**
303
+ * Phase 2 (Section H): server-side verification of a Google Chat sender via
304
+ * the agent's existing Google OAuth credentials. Returns the resolved
305
+ * identity (created or matched via Scenario-B email enrichment).
306
+ */
307
+ async resolveGoogleChatSender(args) {
308
+ return this.request("/agent/google/resolve-sender", {
309
+ method: "POST",
310
+ body: JSON.stringify(args)
311
+ });
312
+ }
248
313
  async memorySearch(query, opts) {
249
314
  return this.request("/agent/memory/search", {
250
315
  method: "POST",
@@ -318,6 +383,15 @@ var AgentApiClient = class {
318
383
  body: JSON.stringify(params)
319
384
  });
320
385
  }
386
+ async registerDatabaseCredentials() {
387
+ return this.request("/agent/database/register", { method: "POST" });
388
+ }
389
+ async reportDatabaseAudit(entry) {
390
+ await this.request("/agent/database/audit", {
391
+ method: "POST",
392
+ body: JSON.stringify(entry)
393
+ }).catch(() => {});
394
+ }
321
395
  };
322
396
  //#endregion
323
397
  exports.AgentApiClient = AgentApiClient;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  //#region ../../packages-internal/types/dist/access.d.ts
2
+
2
3
  /**
3
4
  * The four resource scopes at which a permission can apply.
4
5
  * Order is meaningful: broader scopes first (`org`) → narrower last (`agent`).
@@ -166,11 +167,147 @@ interface AgentApiClientConfig {
166
167
  apiKey: string;
167
168
  apiUrl: string;
168
169
  }
170
+ interface SyncAgentInfo {
171
+ agentId: string;
172
+ tenantId: string;
173
+ displayName: string;
174
+ s3Prefix: string;
175
+ status: "stale" | "syncing" | "synced";
176
+ fileCount?: number;
177
+ totalSize?: number;
178
+ lastSync?: string;
179
+ }
180
+ interface SyncManifestEntry {
181
+ hash: string;
182
+ size: number;
183
+ modified: string;
184
+ etag?: string;
185
+ storageClass?: string;
186
+ compressed?: boolean;
187
+ }
188
+ interface SyncManifest {
189
+ version: 1;
190
+ agentId: string;
191
+ lastSync: string;
192
+ files: Record<string, SyncManifestEntry>;
193
+ }
194
+ interface SyncPresignedUrl {
195
+ path: string;
196
+ url: string;
197
+ expiresAt: string;
198
+ }
199
+ interface SyncConfirmedUpload {
200
+ filePath: string;
201
+ hash: string;
202
+ size: number;
203
+ storageClass: "STANDARD" | "GLACIER_IR";
204
+ syncedAt: string;
205
+ }
206
+ interface SyncReconstructFile {
207
+ path: string;
208
+ size: number;
209
+ url: string;
210
+ storageClass?: string;
211
+ compressed?: boolean;
212
+ }
213
+ interface SyncReconstructBundle {
214
+ agentId: string;
215
+ mode: "full" | "active" | "memory";
216
+ fileCount: number;
217
+ totalSize: number;
218
+ files: SyncReconstructFile[];
219
+ expiresAt: string;
220
+ }
221
+ interface SyncAgentStats {
222
+ agentId: string;
223
+ standardBytes: number;
224
+ glacierBytes: number;
225
+ fileCount: number;
226
+ lastSyncAt: string | null;
227
+ }
228
+ interface SyncFileEntry {
229
+ filePath: string;
230
+ size: number;
231
+ modified: string;
232
+ contentHash: string;
233
+ storageClass?: string;
234
+ compressed?: boolean;
235
+ }
236
+ interface SyncSessionEntry {
237
+ sessionId: string;
238
+ size: number;
239
+ lastModified: string;
240
+ storageClass?: string;
241
+ isArchived: boolean;
242
+ }
243
+ interface SyncSessionContent {
244
+ sessionId: string;
245
+ content: string;
246
+ compressed: boolean;
247
+ }
248
+ interface SharedFileEntry {
249
+ filePath: string;
250
+ fileName: string;
251
+ size: number;
252
+ contentType?: string;
253
+ }
169
254
  declare class AgentApiClient {
170
255
  private readonly apiKey;
171
256
  private readonly apiUrl;
172
257
  constructor(config: AgentApiClientConfig);
173
258
  private request;
259
+ syncRegister(args?: {
260
+ displayName?: string;
261
+ }): Promise<{
262
+ agent: SyncAgentInfo;
263
+ }>;
264
+ syncGetManifest(): Promise<SyncManifest>;
265
+ syncPresign(args: {
266
+ files: {
267
+ path: string;
268
+ operation: "put" | "get";
269
+ contentType?: string;
270
+ }[];
271
+ }): Promise<{
272
+ urls: SyncPresignedUrl[];
273
+ }>;
274
+ syncConfirmUpload(args: {
275
+ filePath: string;
276
+ hash: string;
277
+ size: number;
278
+ storageClass?: "STANDARD" | "GLACIER_IR";
279
+ }): Promise<SyncConfirmedUpload>;
280
+ syncReconstruct(args: {
281
+ mode: "full" | "active" | "memory";
282
+ }): Promise<SyncReconstructBundle>;
283
+ syncGetStats(): Promise<SyncAgentStats>;
284
+ syncListFiles(args?: {
285
+ prefix?: string;
286
+ }): Promise<{
287
+ files: SyncFileEntry[];
288
+ }>;
289
+ syncListSessions(): Promise<{
290
+ sessions: SyncSessionEntry[];
291
+ }>;
292
+ syncGetSession(sessionId: string): Promise<SyncSessionContent>;
293
+ syncDeleteFile(filePath: string): Promise<{
294
+ removed: boolean;
295
+ }>;
296
+ sharedListFiles(args: {
297
+ scope: "org" | "team" | "project";
298
+ scopeId: string;
299
+ }): Promise<{
300
+ files: SharedFileEntry[];
301
+ nextCursor: string | null;
302
+ }>;
303
+ sharedDownloadUrl(args: {
304
+ scope: "org" | "team" | "project";
305
+ scopeId: string;
306
+ filePath: string;
307
+ }): Promise<{
308
+ downloadUrl: string;
309
+ expiresIn: number;
310
+ }>;
174
311
  listIntegrations(): Promise<IntegrationInstall[]>;
175
312
  getIntegrationConfig(integrationId: string): Promise<IntegrationConfigResult>;
176
313
  updateIntegrationConfig(integrationId: string, config: Record<string, unknown>): Promise<void>;
@@ -374,8 +511,9 @@ declare class AgentApiClient {
374
511
  /** Enumerate scopes (org/team/project/agent) this agent can access. */
375
512
  listSecretScopes(): Promise<ScopeInfo[]>;
376
513
  resolveIdentity(args: {
377
- platform: string;
514
+ provider: string;
378
515
  platformId: string;
516
+ kind?: "user" | "agent" | "service" | "bot" | "workspace";
379
517
  displayName?: string;
380
518
  }): Promise<{
381
519
  identityId: string | null;
@@ -384,41 +522,15 @@ declare class AgentApiClient {
384
522
  created?: boolean;
385
523
  reason?: string;
386
524
  }>;
387
- enforcePolicy(args: {
388
- platform: string;
389
- senderId: string;
390
- channelId?: string;
391
- }): Promise<{
392
- identityId: string | null;
393
- orgId: string | null;
394
- role: string | null;
395
- allowedTools: string[];
396
- deniedTools: string[];
397
- identified: boolean;
398
- }>;
399
- checkToolPermission(args: {
400
- platform: string;
401
- senderId: string;
402
- toolName: string;
403
- toolArgs?: Record<string, unknown>;
404
- channelId?: string;
405
- }): Promise<{
406
- allowed: boolean;
407
- reason?: string;
408
- }>;
409
525
  searchIdentities(args?: {
410
526
  q?: string;
411
527
  status?: string;
412
- tag?: string;
413
- platform?: string;
414
528
  limit?: number;
415
- offset?: number;
416
529
  }): Promise<{
417
530
  identities: unknown[];
418
531
  }>;
419
532
  getIdentityContext(identityId: string): Promise<{
420
- identity: unknown;
421
- recentChanges: unknown[];
533
+ context: unknown;
422
534
  }>;
423
535
  mergeIdentities(survivorId: string, args: {
424
536
  mergedId: string;
@@ -465,7 +577,6 @@ declare class AgentApiClient {
465
577
  }>;
466
578
  getIdentityChangelog(identityId: string, args?: {
467
579
  limit?: number;
468
- offset?: number;
469
580
  }): Promise<{
470
581
  entries: unknown[];
471
582
  }>;
@@ -483,9 +594,17 @@ declare class AgentApiClient {
483
594
  requestIdentityVerification(args: {
484
595
  claimedIdentityId: string;
485
596
  requestingIdentityId: string;
486
- requestingPlatform: string;
597
+ requestingProvider: string;
487
598
  requestingPlatformId: string;
488
- preferredChannel?: "sms" | "email";
599
+ preferredChannel?: "mobile" | "email";
600
+ /**
601
+ * Phase 2: agent-supplied contact endpoint. When provided, the top-level
602
+ * `preferredChannel` is ignored — the contact's channel wins.
603
+ */
604
+ contact?: {
605
+ channel: "email" | "mobile";
606
+ value: string;
607
+ };
489
608
  }): Promise<{
490
609
  verificationId: string;
491
610
  channel: string;
@@ -495,15 +614,47 @@ declare class AgentApiClient {
495
614
  channel: string;
496
615
  deliveredTo: string;
497
616
  }[];
617
+ } | {
618
+ error: string;
498
619
  }>;
499
620
  confirmIdentityVerification(args: {
621
+ claimedIdentityId: string;
500
622
  verificationId: string;
501
623
  phrase: string;
502
624
  }): Promise<{
503
625
  verified: boolean;
504
626
  identityId?: string;
627
+ /** Phase 2: how the confirm resolved — Scenario A vs B. */
628
+ action?: "merged" | "contact_verified";
505
629
  error?: string;
506
630
  }>;
631
+ /**
632
+ * Update display-shape fields on an Identity. Body excludes `email` /
633
+ * `phone` / `title` / `company` / `metadata` per Section D4 — contacts go
634
+ * via the verify flow, title/company live on OrgMembership, metadata is
635
+ * not agent-writable.
636
+ */
637
+ updateIdentity(identityId: string, args: {
638
+ name?: string;
639
+ avatarUrl?: string;
640
+ timezone?: string;
641
+ locale?: string;
642
+ }): Promise<{
643
+ ok: boolean;
644
+ }>;
645
+ /**
646
+ * Phase 2 (Section H): server-side verification of a Google Chat sender via
647
+ * the agent's existing Google OAuth credentials. Returns the resolved
648
+ * identity (created or matched via Scenario-B email enrichment).
649
+ */
650
+ resolveGoogleChatSender(args: {
651
+ senderUserId: string;
652
+ spaceId?: string;
653
+ }): Promise<{
654
+ identityId: string | null;
655
+ status: string;
656
+ accessAllowed: boolean;
657
+ }>;
507
658
  memorySearch(query: string, opts?: {
508
659
  limit?: number;
509
660
  topic?: string;
@@ -598,8 +749,20 @@ declare class AgentApiClient {
598
749
  count?: number;
599
750
  freshness?: string;
600
751
  }): Promise<unknown>;
752
+ registerDatabaseCredentials(): Promise<{
753
+ connectionString: string;
754
+ username: string;
755
+ password: string;
756
+ databases: string[];
757
+ }>;
758
+ reportDatabaseAudit(entry: {
759
+ database: string;
760
+ collection: string;
761
+ operation: string;
762
+ summary?: string;
763
+ }): Promise<void>;
601
764
  }
602
765
  //# sourceMappingURL=index.d.ts.map
603
766
  //#endregion
604
- export { AgentApiClient, AgentApiClientConfig, type EncryptedEnvelopeV1, type GeneratedDataKey, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, type RegistryEntry, type ScopeInfo, type SecretEnvelopeResponse, type SecretMetadata, type SecretScope };
767
+ export { AgentApiClient, AgentApiClientConfig, type EncryptedEnvelopeV1, type GeneratedDataKey, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, type RegistryEntry, type ScopeInfo, type SecretEnvelopeResponse, type SecretMetadata, type SecretScope, SharedFileEntry, SyncAgentInfo, SyncAgentStats, SyncConfirmedUpload, SyncFileEntry, SyncManifest, SyncManifestEntry, SyncPresignedUrl, SyncReconstructBundle, SyncReconstructFile, SyncSessionContent, SyncSessionEntry };
605
768
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["ResourceScope","RESOURCE_SCOPES","AccessLevel","ScopedAccess","AllScopedAccess","ResourceScope","DEFAULT_INTEGRATIONS","IntegrationVisibility","INTEGRATION_VISIBILITIES","IntegrationScope","INTEGRATION_SCOPES","IntegrationDesiredStatus","INTEGRATION_DESIRED_STATUSES","IntegrationActualStatus","INTEGRATION_ACTUAL_STATUSES","IntegrationInstall","Record","AgentIntegration","OrgIntegration","IntegrationConfigSchemaField","IntegrationConfigResult","RegistryEntry","ResourceScope","SecretScope","SECRET_SCOPES","EncryptedEnvelopeV1","SecretMetadata","SecretEnvelopeResponse","ScopeInfo","GeneratedDataKey"],"sources":["../../../packages-internal/types/dist/access.d.ts","../../../packages-internal/types/dist/integration.d.ts","../../../packages-internal/types/dist/secrets.d.ts","../src/index.ts"],"sourcesContent":["/**\n * The four resource scopes at which a permission can apply.\n * Order is meaningful: broader scopes first (`org`) → narrower last (`agent`).\n *\n * `IntegrationScope` in integration.ts and `SecretScope` in secrets.ts are\n * intentional aliases of this same enum — there is only one concept of\n * \"scope\" in Alfe.\n */\nexport declare const ResourceScope: {\n readonly Org: \"org\";\n readonly Team: \"team\";\n readonly Project: \"project\";\n readonly Agent: \"agent\";\n};\nexport type ResourceScope = (typeof ResourceScope)[keyof typeof ResourceScope];\n/** Ordered tuple of resource scope string values (broad → narrow). */\nexport declare const RESOURCE_SCOPES: readonly [\"org\" | \"team\" | \"project\" | \"agent\", ...(\"org\" | \"team\" | \"project\" | \"agent\")[]];\nexport declare const AccessLevel: {\n readonly None: \"none\";\n readonly Read: \"read\";\n readonly Write: \"write\";\n readonly Manage: \"manage\";\n};\nexport type AccessLevel = (typeof AccessLevel)[keyof typeof AccessLevel];\nexport interface ScopedAccess {\n scope: ResourceScope;\n scopeId: string;\n accessLevel: AccessLevel;\n /** Resolved role label (e.g. \"org_admin\", \"team_member\") */\n role: string;\n}\nexport interface AllScopedAccess {\n orgAccess: ScopedAccess;\n teamAccess: ScopedAccess[];\n projectAccess: ScopedAccess[];\n}\n//# sourceMappingURL=access.d.ts.map","import { ResourceScope } from \"./access.js\";\n/** Integrations auto-installed for ALL agents regardless of hosting type. Cannot be removed. */\nexport declare const DEFAULT_INTEGRATIONS: readonly string[];\n/** Controls where an integration appears: public (everyone), hidden (nowhere) */\nexport declare const IntegrationVisibility: {\n readonly Public: \"public\";\n readonly Hidden: \"hidden\";\n};\nexport type IntegrationVisibility = (typeof IntegrationVisibility)[keyof typeof IntegrationVisibility];\nexport declare const INTEGRATION_VISIBILITIES: readonly [\"public\" | \"hidden\", ...(\"public\" | \"hidden\")[]];\n/** Scope at which an integration is installed */\nexport declare const IntegrationScope: {\n readonly Org: \"org\";\n readonly Team: \"team\";\n readonly Project: \"project\";\n readonly Agent: \"agent\";\n};\nexport type IntegrationScope = ResourceScope;\nexport declare const INTEGRATION_SCOPES: readonly [\"org\" | \"team\" | \"project\" | \"agent\", ...(\"org\" | \"team\" | \"project\" | \"agent\")[]];\nexport declare const IntegrationDesiredStatus: {\n readonly Active: \"active\";\n readonly Removed: \"removed\";\n};\nexport type IntegrationDesiredStatus = (typeof IntegrationDesiredStatus)[keyof typeof IntegrationDesiredStatus];\nexport declare const INTEGRATION_DESIRED_STATUSES: readonly [\"active\" | \"removed\", ...(\"active\" | \"removed\")[]];\nexport declare const IntegrationActualStatus: {\n readonly Installing: \"installing\";\n readonly Active: \"active\";\n readonly Error: \"error\";\n readonly Removing: \"removing\";\n readonly Inactive: \"inactive\";\n readonly Unknown: \"unknown\";\n};\nexport type IntegrationActualStatus = (typeof IntegrationActualStatus)[keyof typeof IntegrationActualStatus];\nexport declare const INTEGRATION_ACTUAL_STATUSES: readonly [\"active\" | \"error\" | \"installing\" | \"removing\" | \"inactive\" | \"unknown\", ...(\"active\" | \"error\" | \"installing\" | \"removing\" | \"inactive\" | \"unknown\")[]];\nexport interface IntegrationInstall {\n scope: IntegrationScope;\n scopeId: string;\n integrationId: string;\n tenantId: string;\n desiredStatus: IntegrationDesiredStatus;\n actualStatus: IntegrationActualStatus;\n version: string;\n config: Record<string, unknown>;\n errorMessage: string;\n installedAt: string;\n updatedAt: string;\n}\n/** @deprecated Use IntegrationInstall instead */\nexport type AgentIntegration = IntegrationInstall;\n/** Org-scoped integration install */\nexport type OrgIntegration = IntegrationInstall;\nexport interface IntegrationConfigSchemaField {\n key: string;\n label: string;\n type: string;\n description?: string;\n required?: boolean;\n default?: string | number | boolean;\n options?: string[];\n select_options?: {\n value: string;\n label: string;\n }[];\n oauth_provider?: string;\n oauth_scopes?: string[];\n oauth_integration_id?: string;\n editable?: string;\n hidden?: boolean;\n}\nexport interface IntegrationConfigResult {\n integrationId: string;\n config: Record<string, unknown>;\n configSchema: IntegrationConfigSchemaField[];\n}\nexport interface RegistryEntry {\n id: string;\n name: string;\n description: string;\n versions: string[];\n latest: string;\n repository: string;\n commit: string;\n icon?: string;\n author?: {\n name: string;\n url?: string;\n } | string;\n pricing?: {\n type: \"free\" | \"paid\" | \"usage\";\n price?: number;\n currency?: string;\n interval?: \"month\" | \"year\";\n description?: string;\n };\n features?: string[];\n preview_images?: string[];\n config_schema?: IntegrationConfigSchemaField[];\n supported_agents?: string[];\n /** Scopes where this integration can be installed */\n supported_scopes?: IntegrationScope[];\n /** Visibility status — controls where integration appears */\n visibility?: IntegrationVisibility;\n}\n//# sourceMappingURL=integration.d.ts.map","/**\n * Secrets types — shared between services/secrets, @alfe.ai/agent-api-client,\n * the openclaw-secrets plugin, and dashboard clients.\n *\n * Server-side crypto and KMS glue live in @alfe/secret-store (Node/AWS-only);\n * this module is a pure, dependency-free shape contract safe for every\n * environment the agent-api-client ships to.\n */\nimport type { ResourceScope } from \"./access.js\";\n/** Scope levels at which a secret can be owned. Aliased to ResourceScope. */\nexport type SecretScope = ResourceScope;\nexport declare const SECRET_SCOPES: readonly [\"org\" | \"team\" | \"project\" | \"agent\", ...(\"org\" | \"team\" | \"project\" | \"agent\")[]];\n/**\n * v1 encrypted envelope as persisted by services/secrets and exchanged with\n * agents. Values are AES-256-GCM ciphertext; iv/authTag/ciphertext/dataKeyCiphertext\n * are all base64-encoded.\n */\nexport interface EncryptedEnvelopeV1 {\n version: 1;\n iv: string;\n ciphertext: string;\n authTag: string;\n dataKeyCiphertext: string;\n}\n/** Opaque metadata about a secret row — never includes plaintext. */\nexport interface SecretMetadata {\n secretId: string;\n secretName: string;\n description?: string;\n tags?: string[];\n createdAt: string;\n updatedAt: string;\n rotatedAt?: string;\n}\n/** A single secret row including its encrypted envelope. */\nexport interface SecretEnvelopeResponse extends SecretMetadata {\n envelope: EncryptedEnvelopeV1;\n}\n/** A scope the caller can read or write secrets in. */\nexport interface ScopeInfo {\n scope: SecretScope;\n scopeId: string;\n name?: string;\n}\n/**\n * KMS-issued data key, returned by the secrets service's\n * `/secrets/generate-data-key` KMS proxy endpoint. The plaintext key is\n * returned base64-encoded; callers MUST decode it to a Buffer and zero the\n * Buffer after use — never keep the plaintext as a JS string.\n */\nexport interface GeneratedDataKey {\n plaintextKey: string;\n dataKeyCiphertext: string;\n}\n//# sourceMappingURL=secrets.d.ts.map"],"mappings":";;AAQA;AAMA;;;;;;cANqBA;;ECJAO,SAAAA,IAAAA,EAAAA,MAAAA;EAITA,SAAAA,OAAAA,EAAAA,SAAqB;EAAA,SAAA,KAA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;;MAGL,QAAQ;;;WAQH;;MAEL,QAAQ;;;WASH;;;MAGL;;sBAQsB,QAAQ;;;;;MAc9B;;;;;;;;;;;MAiBA;;;;;;;;;;;;eAkBS;;MAET;;;;;;;;;;;MAcA;;;0CAY0C;;;;;;;;;;;MAU1C;;;;;;;;;;MASA;;;;;;;;;;;;MAWA;;;;;;;;;;;MAWA;;;;;;MAUA;;;;;;;;;;MAWA;;;;;;;;;;MAaA;;;;;;;;;;;;;MAgBA;;;;;;;;;;;MAkBA;;;;;;;;;;;;;;;;;;;;;;;;MAsBA;;;;;;;;;;;;MAsBA;;;;wDAYwD;;;;uCAWjB;;;;;;;;;;;oBAOnB;;;;;;;;kCAOc;;;iBAMjB;;;;;;;;;;;;MAiBjB;;;;MAUA;;;;;MAWA"}
1
+ {"version":3,"file":"index.d.cts","names":["PERMISSION_CATALOG","Record","TENANT_ALLOWED_SUBJECTS","TenantAllowedSubject","ResourceScope","RESOURCE_SCOPES","AccessLevel","ScopedAccess","AllScopedAccess","ResourceScope","DEFAULT_INTEGRATIONS","IntegrationVisibility","INTEGRATION_VISIBILITIES","IntegrationScope","INTEGRATION_SCOPES","IntegrationDesiredStatus","INTEGRATION_DESIRED_STATUSES","IntegrationActualStatus","INTEGRATION_ACTUAL_STATUSES","IntegrationInstall","Record","AgentIntegration","OrgIntegration","IntegrationConfigSchemaField","IntegrationConfigResult","RegistryEntry","ResourceScope","SecretScope","SECRET_SCOPES","EncryptedEnvelopeV1","SecretMetadata","SecretEnvelopeResponse","ScopeInfo","GeneratedDataKey"],"sources":["../../../packages-internal/types/dist/access.d.ts","../../../packages-internal/types/dist/integration.d.ts","../../../packages-internal/types/dist/secrets.d.ts","../src/index.ts"],"sourcesContent":["/**\n * Runtime catalog of declared permission subjects + allowed actions.\n *\n * Mirrors the compile-time `PermissionDefinitions` augmentation in\n * `@alfe/api-core/auriclabs-roles.ts`. Kept here so browser code\n * (dashboard) can consume it without pulling in server-only deps\n * (`@middy/core`, `aws-lambda`, etc.).\n */\nexport declare const PERMISSION_CATALOG: Record<string, readonly string[]>;\n/**\n * Subjects a tenant may grant via a custom role.\n *\n * Excludes `all` (platform-admin escape hatch) and `admin_*` subjects.\n */\nexport declare const TENANT_ALLOWED_SUBJECTS: readonly [\"agent\", \"sync\", \"integration\", \"secret\", \"database\", \"template\", \"org_file\", \"team\", \"project\", \"model_policy\", \"role_management\", \"billing\", \"identity\", \"token\", \"user\", \"gateway\", \"voice\"];\nexport type TenantAllowedSubject = (typeof TENANT_ALLOWED_SUBJECTS)[number];\n/**\n * The four resource scopes at which a permission can apply.\n * Order is meaningful: broader scopes first (`org`) → narrower last (`agent`).\n *\n * `IntegrationScope` in integration.ts and `SecretScope` in secrets.ts are\n * intentional aliases of this same enum — there is only one concept of\n * \"scope\" in Alfe.\n */\nexport declare const ResourceScope: {\n readonly Org: \"org\";\n readonly Team: \"team\";\n readonly Project: \"project\";\n readonly Agent: \"agent\";\n};\nexport type ResourceScope = (typeof ResourceScope)[keyof typeof ResourceScope];\n/** Ordered tuple of resource scope string values (broad → narrow). */\nexport declare const RESOURCE_SCOPES: readonly [\"agent\" | \"team\" | \"project\" | \"org\", ...(\"agent\" | \"team\" | \"project\" | \"org\")[]];\nexport declare const AccessLevel: {\n readonly None: \"none\";\n readonly Read: \"read\";\n readonly Write: \"write\";\n readonly Manage: \"manage\";\n};\nexport type AccessLevel = (typeof AccessLevel)[keyof typeof AccessLevel];\nexport interface ScopedAccess {\n scope: ResourceScope;\n scopeId: string;\n accessLevel: AccessLevel;\n /** Resolved role label (e.g. \"org_admin\", \"team_member\") */\n role: string;\n}\nexport interface AllScopedAccess {\n orgAccess: ScopedAccess;\n teamAccess: ScopedAccess[];\n projectAccess: ScopedAccess[];\n}\n//# sourceMappingURL=access.d.ts.map","import { ResourceScope } from \"./access.js\";\n/** Integrations auto-installed for ALL agents regardless of hosting type. Cannot be removed. */\nexport declare const DEFAULT_INTEGRATIONS: readonly string[];\n/** Controls where an integration appears: public (everyone), hidden (nowhere) */\nexport declare const IntegrationVisibility: {\n readonly Public: \"public\";\n readonly Hidden: \"hidden\";\n};\nexport type IntegrationVisibility = (typeof IntegrationVisibility)[keyof typeof IntegrationVisibility];\nexport declare const INTEGRATION_VISIBILITIES: readonly [\"public\" | \"hidden\", ...(\"public\" | \"hidden\")[]];\n/** Scope at which an integration is installed */\nexport declare const IntegrationScope: {\n readonly Org: \"org\";\n readonly Team: \"team\";\n readonly Project: \"project\";\n readonly Agent: \"agent\";\n};\nexport type IntegrationScope = ResourceScope;\nexport declare const INTEGRATION_SCOPES: readonly [\"agent\" | \"team\" | \"project\" | \"org\", ...(\"agent\" | \"team\" | \"project\" | \"org\")[]];\nexport declare const IntegrationDesiredStatus: {\n readonly Active: \"active\";\n readonly Removed: \"removed\";\n};\nexport type IntegrationDesiredStatus = (typeof IntegrationDesiredStatus)[keyof typeof IntegrationDesiredStatus];\nexport declare const INTEGRATION_DESIRED_STATUSES: readonly [\"active\" | \"removed\", ...(\"active\" | \"removed\")[]];\nexport declare const IntegrationActualStatus: {\n readonly Installing: \"installing\";\n readonly Active: \"active\";\n readonly Error: \"error\";\n readonly Removing: \"removing\";\n readonly Inactive: \"inactive\";\n readonly Unknown: \"unknown\";\n};\nexport type IntegrationActualStatus = (typeof IntegrationActualStatus)[keyof typeof IntegrationActualStatus];\nexport declare const INTEGRATION_ACTUAL_STATUSES: readonly [\"active\" | \"error\" | \"installing\" | \"removing\" | \"inactive\" | \"unknown\", ...(\"active\" | \"error\" | \"installing\" | \"removing\" | \"inactive\" | \"unknown\")[]];\nexport interface IntegrationInstall {\n scope: IntegrationScope;\n scopeId: string;\n integrationId: string;\n tenantId: string;\n desiredStatus: IntegrationDesiredStatus;\n actualStatus: IntegrationActualStatus;\n version: string;\n config: Record<string, unknown>;\n errorMessage: string;\n installedAt: string;\n updatedAt: string;\n}\n/** @deprecated Use IntegrationInstall instead */\nexport type AgentIntegration = IntegrationInstall;\n/** Org-scoped integration install */\nexport type OrgIntegration = IntegrationInstall;\nexport interface IntegrationConfigSchemaField {\n key: string;\n label: string;\n type: string;\n description?: string;\n required?: boolean;\n default?: string | number | boolean;\n options?: string[];\n select_options?: {\n value: string;\n label: string;\n }[];\n oauth_provider?: string;\n oauth_scopes?: string[];\n oauth_integration_id?: string;\n editable?: string;\n hidden?: boolean;\n}\nexport interface IntegrationConfigResult {\n integrationId: string;\n config: Record<string, unknown>;\n configSchema: IntegrationConfigSchemaField[];\n}\nexport interface RegistryEntry {\n id: string;\n name: string;\n description: string;\n versions: string[];\n latest: string;\n repository: string;\n commit: string;\n icon?: string;\n author?: {\n name: string;\n url?: string;\n } | string;\n pricing?: {\n type: \"free\" | \"paid\" | \"usage\";\n price?: number;\n currency?: string;\n interval?: \"month\" | \"year\";\n description?: string;\n };\n features?: string[];\n preview_images?: string[];\n config_schema?: IntegrationConfigSchemaField[];\n supported_agents?: string[];\n /** Scopes where this integration can be installed */\n supported_scopes?: IntegrationScope[];\n /** Visibility status — controls where integration appears */\n visibility?: IntegrationVisibility;\n}\n//# sourceMappingURL=integration.d.ts.map","/**\n * Secrets types — shared between services/secrets, @alfe.ai/agent-api-client,\n * the openclaw-secrets plugin, and dashboard clients.\n *\n * Server-side crypto and KMS glue live in @alfe/secret-store (Node/AWS-only);\n * this module is a pure, dependency-free shape contract safe for every\n * environment the agent-api-client ships to.\n */\nimport type { ResourceScope } from \"./access.js\";\n/** Scope levels at which a secret can be owned. Aliased to ResourceScope. */\nexport type SecretScope = ResourceScope;\nexport declare const SECRET_SCOPES: readonly [\"agent\" | \"team\" | \"project\" | \"org\", ...(\"agent\" | \"team\" | \"project\" | \"org\")[]];\n/**\n * v1 encrypted envelope as persisted by services/secrets and exchanged with\n * agents. Values are AES-256-GCM ciphertext; iv/authTag/ciphertext/dataKeyCiphertext\n * are all base64-encoded.\n */\nexport interface EncryptedEnvelopeV1 {\n version: 1;\n iv: string;\n ciphertext: string;\n authTag: string;\n dataKeyCiphertext: string;\n}\n/** Opaque metadata about a secret row — never includes plaintext. */\nexport interface SecretMetadata {\n secretId: string;\n secretName: string;\n description?: string;\n tags?: string[];\n createdAt: string;\n updatedAt: string;\n rotatedAt?: string;\n}\n/** A single secret row including its encrypted envelope. */\nexport interface SecretEnvelopeResponse extends SecretMetadata {\n envelope: EncryptedEnvelopeV1;\n}\n/** A scope the caller can read or write secrets in. */\nexport interface ScopeInfo {\n scope: SecretScope;\n scopeId: string;\n name?: string;\n}\n/**\n * KMS-issued data key, returned by the secrets service's\n * `/secrets/generate-data-key` KMS proxy endpoint. The plaintext key is\n * returned base64-encoded; callers MUST decode it to a Buffer and zero the\n * Buffer after use — never keep the plaintext as a JS string.\n */\nexport interface GeneratedDataKey {\n plaintextKey: string;\n dataKeyCiphertext: string;\n}\n//# sourceMappingURL=secrets.d.ts.map"],"mappings":";;ACWA;AAMA;AAEA;AAIA;;;;;AAEqBiB,cDDAb,aCQpB,EAAA;EACWa,SAAAA,GAAAA,EAAAA,KAAAA;EAAuB,SAAA,IAAA,EAAA,MAAA;WAAWA,OAAAA,EAAAA,SAAAA;WAAsCA,KAAAA,EAAAA,OAAAA;CAAuB;AAE1FE,KDLLf,aAAAA,GCKuB,CAAA,ODLCA,aCKD,CAAA,CAAA,MAAA,ODL6BA,aCK7B,CAAA;;;;;ADLCA,cC1BfO,qBD0BeP,EAAAA;WAA4BA,MAAAA,EAAAA,QAAAA;EAAa,SAAA,MAAA,EAAA,QAAA;;KCtBjEO,qBAAAA,WAAgCA,oCAAoCA;AAJhF;AAIYA,cAGSE,gBAHY,EAAA;EAAA,SAAA,GAAA,EAAA,KAAA;WAAWF,IAAAA,EAAAA,MAAAA;WAAoCA,OAAAA,EAAAA,SAAAA;EAAqB,SAAA,KAAA,EAAA,OAAA;AAGrG,CAAA;AAMYE,KAAAA,gBAAAA,GAAmBJ,aAAAA;AAMnBM,cAJSA,wBAIe,EAAA;EAAA,SAAA,MAAA,EAAA,QAAA;WAAWA,OAAAA,EAAAA,SAAAA;;AAA+D,KAAlGA,wBAAAA,G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AAA;MAOnB,KAAA,EAAA,MAAA;MAOc,YAAA,EAAA,MAAA;MAMjB,QAAA,EAAA,MAAA;MAiBjB,YAAA,EAAA,MAAA;MAUA,eAAA,CAAA,EAAA,MAAA,EAAA;MAWA,SAAA,EAAA,OAAA;MASiC,WAAA,CAAA,EAAA,MAAA;IAcjC,CAAA,EAAA;IAAO,KAAA,EAAA,MAAA;;;;;;;0CAtlBmC;;;;;;;0CAQA;;;;;;;8BAQZ;;;;;;;0BAUJ;;;;wBAOF;;;;;sBAQF;;;;0BAOI;;;;;6BAQG;;;;;;;;;;;;2BAeF;;;;wBAOH;;;;;;sBASF;;;;yBAOG;;;;;;;;;;;;;mBAgBZ;MACb;;;;uBAOuB;;;;;;;;;;;QAM8D;;;;;;;;;;;;;MAarF;;;;;;;;;WAgCK;;;MAGL,QAAQ;;;;;;;WAaH;;;;MAIL;;;;;WASK;;;;cAIG;;;MAGR;;;;;WAaK;;;MAGL,QAAQ;;;WAQH;;MAEL,QAAQ;;;WASH;;;MAGL;;sBAQsB,QAAQ;;;;;;MAe9B;;;;;;;;;;;MAiBA;;;0CAS0C;;;;;;;;;;MAS1C;;;;;;;;;;MASA;;;;;;;;;;;;MAWA;;;;;;;;;;;MAWA;;;;;MASA;;;;;;;;;;MAUA;;;;;;;;;;;;;;;;;;MAkBA;;;;;;;;;;;;;;;;MAiBA;;;;;;;;;;;;;;;;;;MA2BD;;;;;;;;;;;MAeC;;;;;;;;;;;MAsBA;;;;;;;;;;;;;;;;;;;;;;;;MAsBA;;;;;;;;;;;;MAsBA;;;;wDAYwD;;;;uCAWjB;;;;;;;;;;;oBAOnB;;;;;;;;kCAOc;;;iBAMjB;;;;;;;;;;;;MAiBjB;;;;MAUA;;;;;MAWA;iCASiC;;;;;;;;;;;MAcjC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  //#region ../../packages-internal/types/dist/access.d.ts
2
+
2
3
  /**
3
4
  * The four resource scopes at which a permission can apply.
4
5
  * Order is meaningful: broader scopes first (`org`) → narrower last (`agent`).
@@ -166,11 +167,147 @@ interface AgentApiClientConfig {
166
167
  apiKey: string;
167
168
  apiUrl: string;
168
169
  }
170
+ interface SyncAgentInfo {
171
+ agentId: string;
172
+ tenantId: string;
173
+ displayName: string;
174
+ s3Prefix: string;
175
+ status: "stale" | "syncing" | "synced";
176
+ fileCount?: number;
177
+ totalSize?: number;
178
+ lastSync?: string;
179
+ }
180
+ interface SyncManifestEntry {
181
+ hash: string;
182
+ size: number;
183
+ modified: string;
184
+ etag?: string;
185
+ storageClass?: string;
186
+ compressed?: boolean;
187
+ }
188
+ interface SyncManifest {
189
+ version: 1;
190
+ agentId: string;
191
+ lastSync: string;
192
+ files: Record<string, SyncManifestEntry>;
193
+ }
194
+ interface SyncPresignedUrl {
195
+ path: string;
196
+ url: string;
197
+ expiresAt: string;
198
+ }
199
+ interface SyncConfirmedUpload {
200
+ filePath: string;
201
+ hash: string;
202
+ size: number;
203
+ storageClass: "STANDARD" | "GLACIER_IR";
204
+ syncedAt: string;
205
+ }
206
+ interface SyncReconstructFile {
207
+ path: string;
208
+ size: number;
209
+ url: string;
210
+ storageClass?: string;
211
+ compressed?: boolean;
212
+ }
213
+ interface SyncReconstructBundle {
214
+ agentId: string;
215
+ mode: "full" | "active" | "memory";
216
+ fileCount: number;
217
+ totalSize: number;
218
+ files: SyncReconstructFile[];
219
+ expiresAt: string;
220
+ }
221
+ interface SyncAgentStats {
222
+ agentId: string;
223
+ standardBytes: number;
224
+ glacierBytes: number;
225
+ fileCount: number;
226
+ lastSyncAt: string | null;
227
+ }
228
+ interface SyncFileEntry {
229
+ filePath: string;
230
+ size: number;
231
+ modified: string;
232
+ contentHash: string;
233
+ storageClass?: string;
234
+ compressed?: boolean;
235
+ }
236
+ interface SyncSessionEntry {
237
+ sessionId: string;
238
+ size: number;
239
+ lastModified: string;
240
+ storageClass?: string;
241
+ isArchived: boolean;
242
+ }
243
+ interface SyncSessionContent {
244
+ sessionId: string;
245
+ content: string;
246
+ compressed: boolean;
247
+ }
248
+ interface SharedFileEntry {
249
+ filePath: string;
250
+ fileName: string;
251
+ size: number;
252
+ contentType?: string;
253
+ }
169
254
  declare class AgentApiClient {
170
255
  private readonly apiKey;
171
256
  private readonly apiUrl;
172
257
  constructor(config: AgentApiClientConfig);
173
258
  private request;
259
+ syncRegister(args?: {
260
+ displayName?: string;
261
+ }): Promise<{
262
+ agent: SyncAgentInfo;
263
+ }>;
264
+ syncGetManifest(): Promise<SyncManifest>;
265
+ syncPresign(args: {
266
+ files: {
267
+ path: string;
268
+ operation: "put" | "get";
269
+ contentType?: string;
270
+ }[];
271
+ }): Promise<{
272
+ urls: SyncPresignedUrl[];
273
+ }>;
274
+ syncConfirmUpload(args: {
275
+ filePath: string;
276
+ hash: string;
277
+ size: number;
278
+ storageClass?: "STANDARD" | "GLACIER_IR";
279
+ }): Promise<SyncConfirmedUpload>;
280
+ syncReconstruct(args: {
281
+ mode: "full" | "active" | "memory";
282
+ }): Promise<SyncReconstructBundle>;
283
+ syncGetStats(): Promise<SyncAgentStats>;
284
+ syncListFiles(args?: {
285
+ prefix?: string;
286
+ }): Promise<{
287
+ files: SyncFileEntry[];
288
+ }>;
289
+ syncListSessions(): Promise<{
290
+ sessions: SyncSessionEntry[];
291
+ }>;
292
+ syncGetSession(sessionId: string): Promise<SyncSessionContent>;
293
+ syncDeleteFile(filePath: string): Promise<{
294
+ removed: boolean;
295
+ }>;
296
+ sharedListFiles(args: {
297
+ scope: "org" | "team" | "project";
298
+ scopeId: string;
299
+ }): Promise<{
300
+ files: SharedFileEntry[];
301
+ nextCursor: string | null;
302
+ }>;
303
+ sharedDownloadUrl(args: {
304
+ scope: "org" | "team" | "project";
305
+ scopeId: string;
306
+ filePath: string;
307
+ }): Promise<{
308
+ downloadUrl: string;
309
+ expiresIn: number;
310
+ }>;
174
311
  listIntegrations(): Promise<IntegrationInstall[]>;
175
312
  getIntegrationConfig(integrationId: string): Promise<IntegrationConfigResult>;
176
313
  updateIntegrationConfig(integrationId: string, config: Record<string, unknown>): Promise<void>;
@@ -374,8 +511,9 @@ declare class AgentApiClient {
374
511
  /** Enumerate scopes (org/team/project/agent) this agent can access. */
375
512
  listSecretScopes(): Promise<ScopeInfo[]>;
376
513
  resolveIdentity(args: {
377
- platform: string;
514
+ provider: string;
378
515
  platformId: string;
516
+ kind?: "user" | "agent" | "service" | "bot" | "workspace";
379
517
  displayName?: string;
380
518
  }): Promise<{
381
519
  identityId: string | null;
@@ -384,41 +522,15 @@ declare class AgentApiClient {
384
522
  created?: boolean;
385
523
  reason?: string;
386
524
  }>;
387
- enforcePolicy(args: {
388
- platform: string;
389
- senderId: string;
390
- channelId?: string;
391
- }): Promise<{
392
- identityId: string | null;
393
- orgId: string | null;
394
- role: string | null;
395
- allowedTools: string[];
396
- deniedTools: string[];
397
- identified: boolean;
398
- }>;
399
- checkToolPermission(args: {
400
- platform: string;
401
- senderId: string;
402
- toolName: string;
403
- toolArgs?: Record<string, unknown>;
404
- channelId?: string;
405
- }): Promise<{
406
- allowed: boolean;
407
- reason?: string;
408
- }>;
409
525
  searchIdentities(args?: {
410
526
  q?: string;
411
527
  status?: string;
412
- tag?: string;
413
- platform?: string;
414
528
  limit?: number;
415
- offset?: number;
416
529
  }): Promise<{
417
530
  identities: unknown[];
418
531
  }>;
419
532
  getIdentityContext(identityId: string): Promise<{
420
- identity: unknown;
421
- recentChanges: unknown[];
533
+ context: unknown;
422
534
  }>;
423
535
  mergeIdentities(survivorId: string, args: {
424
536
  mergedId: string;
@@ -465,7 +577,6 @@ declare class AgentApiClient {
465
577
  }>;
466
578
  getIdentityChangelog(identityId: string, args?: {
467
579
  limit?: number;
468
- offset?: number;
469
580
  }): Promise<{
470
581
  entries: unknown[];
471
582
  }>;
@@ -483,9 +594,17 @@ declare class AgentApiClient {
483
594
  requestIdentityVerification(args: {
484
595
  claimedIdentityId: string;
485
596
  requestingIdentityId: string;
486
- requestingPlatform: string;
597
+ requestingProvider: string;
487
598
  requestingPlatformId: string;
488
- preferredChannel?: "sms" | "email";
599
+ preferredChannel?: "mobile" | "email";
600
+ /**
601
+ * Phase 2: agent-supplied contact endpoint. When provided, the top-level
602
+ * `preferredChannel` is ignored — the contact's channel wins.
603
+ */
604
+ contact?: {
605
+ channel: "email" | "mobile";
606
+ value: string;
607
+ };
489
608
  }): Promise<{
490
609
  verificationId: string;
491
610
  channel: string;
@@ -495,15 +614,47 @@ declare class AgentApiClient {
495
614
  channel: string;
496
615
  deliveredTo: string;
497
616
  }[];
617
+ } | {
618
+ error: string;
498
619
  }>;
499
620
  confirmIdentityVerification(args: {
621
+ claimedIdentityId: string;
500
622
  verificationId: string;
501
623
  phrase: string;
502
624
  }): Promise<{
503
625
  verified: boolean;
504
626
  identityId?: string;
627
+ /** Phase 2: how the confirm resolved — Scenario A vs B. */
628
+ action?: "merged" | "contact_verified";
505
629
  error?: string;
506
630
  }>;
631
+ /**
632
+ * Update display-shape fields on an Identity. Body excludes `email` /
633
+ * `phone` / `title` / `company` / `metadata` per Section D4 — contacts go
634
+ * via the verify flow, title/company live on OrgMembership, metadata is
635
+ * not agent-writable.
636
+ */
637
+ updateIdentity(identityId: string, args: {
638
+ name?: string;
639
+ avatarUrl?: string;
640
+ timezone?: string;
641
+ locale?: string;
642
+ }): Promise<{
643
+ ok: boolean;
644
+ }>;
645
+ /**
646
+ * Phase 2 (Section H): server-side verification of a Google Chat sender via
647
+ * the agent's existing Google OAuth credentials. Returns the resolved
648
+ * identity (created or matched via Scenario-B email enrichment).
649
+ */
650
+ resolveGoogleChatSender(args: {
651
+ senderUserId: string;
652
+ spaceId?: string;
653
+ }): Promise<{
654
+ identityId: string | null;
655
+ status: string;
656
+ accessAllowed: boolean;
657
+ }>;
507
658
  memorySearch(query: string, opts?: {
508
659
  limit?: number;
509
660
  topic?: string;
@@ -598,8 +749,20 @@ declare class AgentApiClient {
598
749
  count?: number;
599
750
  freshness?: string;
600
751
  }): Promise<unknown>;
752
+ registerDatabaseCredentials(): Promise<{
753
+ connectionString: string;
754
+ username: string;
755
+ password: string;
756
+ databases: string[];
757
+ }>;
758
+ reportDatabaseAudit(entry: {
759
+ database: string;
760
+ collection: string;
761
+ operation: string;
762
+ summary?: string;
763
+ }): Promise<void>;
601
764
  }
602
765
  //# sourceMappingURL=index.d.ts.map
603
766
  //#endregion
604
- export { AgentApiClient, AgentApiClientConfig, type EncryptedEnvelopeV1, type GeneratedDataKey, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, type RegistryEntry, type ScopeInfo, type SecretEnvelopeResponse, type SecretMetadata, type SecretScope };
767
+ export { AgentApiClient, AgentApiClientConfig, type EncryptedEnvelopeV1, type GeneratedDataKey, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, type RegistryEntry, type ScopeInfo, type SecretEnvelopeResponse, type SecretMetadata, type SecretScope, SharedFileEntry, SyncAgentInfo, SyncAgentStats, SyncConfirmedUpload, SyncFileEntry, SyncManifest, SyncManifestEntry, SyncPresignedUrl, SyncReconstructBundle, SyncReconstructFile, SyncSessionContent, SyncSessionEntry };
605
768
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["ResourceScope","RESOURCE_SCOPES","AccessLevel","ScopedAccess","AllScopedAccess","ResourceScope","DEFAULT_INTEGRATIONS","IntegrationVisibility","INTEGRATION_VISIBILITIES","IntegrationScope","INTEGRATION_SCOPES","IntegrationDesiredStatus","INTEGRATION_DESIRED_STATUSES","IntegrationActualStatus","INTEGRATION_ACTUAL_STATUSES","IntegrationInstall","Record","AgentIntegration","OrgIntegration","IntegrationConfigSchemaField","IntegrationConfigResult","RegistryEntry","ResourceScope","SecretScope","SECRET_SCOPES","EncryptedEnvelopeV1","SecretMetadata","SecretEnvelopeResponse","ScopeInfo","GeneratedDataKey"],"sources":["../../../packages-internal/types/dist/access.d.ts","../../../packages-internal/types/dist/integration.d.ts","../../../packages-internal/types/dist/secrets.d.ts","../src/index.ts"],"sourcesContent":["/**\n * The four resource scopes at which a permission can apply.\n * Order is meaningful: broader scopes first (`org`) → narrower last (`agent`).\n *\n * `IntegrationScope` in integration.ts and `SecretScope` in secrets.ts are\n * intentional aliases of this same enum — there is only one concept of\n * \"scope\" in Alfe.\n */\nexport declare const ResourceScope: {\n readonly Org: \"org\";\n readonly Team: \"team\";\n readonly Project: \"project\";\n readonly Agent: \"agent\";\n};\nexport type ResourceScope = (typeof ResourceScope)[keyof typeof ResourceScope];\n/** Ordered tuple of resource scope string values (broad → narrow). */\nexport declare const RESOURCE_SCOPES: readonly [\"org\" | \"team\" | \"project\" | \"agent\", ...(\"org\" | \"team\" | \"project\" | \"agent\")[]];\nexport declare const AccessLevel: {\n readonly None: \"none\";\n readonly Read: \"read\";\n readonly Write: \"write\";\n readonly Manage: \"manage\";\n};\nexport type AccessLevel = (typeof AccessLevel)[keyof typeof AccessLevel];\nexport interface ScopedAccess {\n scope: ResourceScope;\n scopeId: string;\n accessLevel: AccessLevel;\n /** Resolved role label (e.g. \"org_admin\", \"team_member\") */\n role: string;\n}\nexport interface AllScopedAccess {\n orgAccess: ScopedAccess;\n teamAccess: ScopedAccess[];\n projectAccess: ScopedAccess[];\n}\n//# sourceMappingURL=access.d.ts.map","import { ResourceScope } from \"./access.js\";\n/** Integrations auto-installed for ALL agents regardless of hosting type. Cannot be removed. */\nexport declare const DEFAULT_INTEGRATIONS: readonly string[];\n/** Controls where an integration appears: public (everyone), hidden (nowhere) */\nexport declare const IntegrationVisibility: {\n readonly Public: \"public\";\n readonly Hidden: \"hidden\";\n};\nexport type IntegrationVisibility = (typeof IntegrationVisibility)[keyof typeof IntegrationVisibility];\nexport declare const INTEGRATION_VISIBILITIES: readonly [\"public\" | \"hidden\", ...(\"public\" | \"hidden\")[]];\n/** Scope at which an integration is installed */\nexport declare const IntegrationScope: {\n readonly Org: \"org\";\n readonly Team: \"team\";\n readonly Project: \"project\";\n readonly Agent: \"agent\";\n};\nexport type IntegrationScope = ResourceScope;\nexport declare const INTEGRATION_SCOPES: readonly [\"org\" | \"team\" | \"project\" | \"agent\", ...(\"org\" | \"team\" | \"project\" | \"agent\")[]];\nexport declare const IntegrationDesiredStatus: {\n readonly Active: \"active\";\n readonly Removed: \"removed\";\n};\nexport type IntegrationDesiredStatus = (typeof IntegrationDesiredStatus)[keyof typeof IntegrationDesiredStatus];\nexport declare const INTEGRATION_DESIRED_STATUSES: readonly [\"active\" | \"removed\", ...(\"active\" | \"removed\")[]];\nexport declare const IntegrationActualStatus: {\n readonly Installing: \"installing\";\n readonly Active: \"active\";\n readonly Error: \"error\";\n readonly Removing: \"removing\";\n readonly Inactive: \"inactive\";\n readonly Unknown: \"unknown\";\n};\nexport type IntegrationActualStatus = (typeof IntegrationActualStatus)[keyof typeof IntegrationActualStatus];\nexport declare const INTEGRATION_ACTUAL_STATUSES: readonly [\"active\" | \"error\" | \"installing\" | \"removing\" | \"inactive\" | \"unknown\", ...(\"active\" | \"error\" | \"installing\" | \"removing\" | \"inactive\" | \"unknown\")[]];\nexport interface IntegrationInstall {\n scope: IntegrationScope;\n scopeId: string;\n integrationId: string;\n tenantId: string;\n desiredStatus: IntegrationDesiredStatus;\n actualStatus: IntegrationActualStatus;\n version: string;\n config: Record<string, unknown>;\n errorMessage: string;\n installedAt: string;\n updatedAt: string;\n}\n/** @deprecated Use IntegrationInstall instead */\nexport type AgentIntegration = IntegrationInstall;\n/** Org-scoped integration install */\nexport type OrgIntegration = IntegrationInstall;\nexport interface IntegrationConfigSchemaField {\n key: string;\n label: string;\n type: string;\n description?: string;\n required?: boolean;\n default?: string | number | boolean;\n options?: string[];\n select_options?: {\n value: string;\n label: string;\n }[];\n oauth_provider?: string;\n oauth_scopes?: string[];\n oauth_integration_id?: string;\n editable?: string;\n hidden?: boolean;\n}\nexport interface IntegrationConfigResult {\n integrationId: string;\n config: Record<string, unknown>;\n configSchema: IntegrationConfigSchemaField[];\n}\nexport interface RegistryEntry {\n id: string;\n name: string;\n description: string;\n versions: string[];\n latest: string;\n repository: string;\n commit: string;\n icon?: string;\n author?: {\n name: string;\n url?: string;\n } | string;\n pricing?: {\n type: \"free\" | \"paid\" | \"usage\";\n price?: number;\n currency?: string;\n interval?: \"month\" | \"year\";\n description?: string;\n };\n features?: string[];\n preview_images?: string[];\n config_schema?: IntegrationConfigSchemaField[];\n supported_agents?: string[];\n /** Scopes where this integration can be installed */\n supported_scopes?: IntegrationScope[];\n /** Visibility status — controls where integration appears */\n visibility?: IntegrationVisibility;\n}\n//# sourceMappingURL=integration.d.ts.map","/**\n * Secrets types — shared between services/secrets, @alfe.ai/agent-api-client,\n * the openclaw-secrets plugin, and dashboard clients.\n *\n * Server-side crypto and KMS glue live in @alfe/secret-store (Node/AWS-only);\n * this module is a pure, dependency-free shape contract safe for every\n * environment the agent-api-client ships to.\n */\nimport type { ResourceScope } from \"./access.js\";\n/** Scope levels at which a secret can be owned. Aliased to ResourceScope. */\nexport type SecretScope = ResourceScope;\nexport declare const SECRET_SCOPES: readonly [\"org\" | \"team\" | \"project\" | \"agent\", ...(\"org\" | \"team\" | \"project\" | \"agent\")[]];\n/**\n * v1 encrypted envelope as persisted by services/secrets and exchanged with\n * agents. Values are AES-256-GCM ciphertext; iv/authTag/ciphertext/dataKeyCiphertext\n * are all base64-encoded.\n */\nexport interface EncryptedEnvelopeV1 {\n version: 1;\n iv: string;\n ciphertext: string;\n authTag: string;\n dataKeyCiphertext: string;\n}\n/** Opaque metadata about a secret row — never includes plaintext. */\nexport interface SecretMetadata {\n secretId: string;\n secretName: string;\n description?: string;\n tags?: string[];\n createdAt: string;\n updatedAt: string;\n rotatedAt?: string;\n}\n/** A single secret row including its encrypted envelope. */\nexport interface SecretEnvelopeResponse extends SecretMetadata {\n envelope: EncryptedEnvelopeV1;\n}\n/** A scope the caller can read or write secrets in. */\nexport interface ScopeInfo {\n scope: SecretScope;\n scopeId: string;\n name?: string;\n}\n/**\n * KMS-issued data key, returned by the secrets service's\n * `/secrets/generate-data-key` KMS proxy endpoint. The plaintext key is\n * returned base64-encoded; callers MUST decode it to a Buffer and zero the\n * Buffer after use — never keep the plaintext as a JS string.\n */\nexport interface GeneratedDataKey {\n plaintextKey: string;\n dataKeyCiphertext: string;\n}\n//# sourceMappingURL=secrets.d.ts.map"],"mappings":";;AAQA;AAMA;;;;;;cANqBA;;ECJAO,SAAAA,IAAAA,EAAAA,MAAAA;EAITA,SAAAA,OAAAA,EAAAA,SAAqB;EAAA,SAAA,KAAA,EAAA,OAAA;;AAA+CA,KDMpEP,aAAAA,GCNoEO,CAAAA,ODM5CP,aCN4CO,CAAAA,CAAAA,MAAAA,ODMhBP,aCNgBO,CAAAA;;;;;ADM5CP,cCVfO,qBDUeP,EAAAA;WAA4BA,MAAAA,EAAAA,QAAAA;EAAa,SAAA,MAAA,EAAA,QAAA;;KCNjEO,qBAAAA,WAAgCA,oCAAoCA;AAJhF;AAIYA,cAGSE,gBAHY,EAAA;EAAA,SAAA,GAAA,EAAA,KAAA;WAAWF,IAAAA,EAAAA,MAAAA;WAAoCA,OAAAA,EAAAA,SAAAA;EAAqB,SAAA,KAAA,EAAA,OAAA;AAGrG,CAAA;AAMYE,KAAAA,gBAAAA,GAAmBJ,aAAAA;AAMnBM,cAJSA,wBAIe,EAAA;EAAA,SAAA,MAAA,EAAA,QAAA;WAAWA,OAAAA,EAAAA,SAAAA;;AAA+D,KAAlGA,wBAAAA,GAAkG,CAAA,OAA/DA,wBAA+D,CAAA,CAAA,MAAA,OAAxBA,wBAAwB,CAAA;AAUlGE,cARSA,uBAQc,EAAA;EAAA,SAAA,UAAA,EAAA,YAAA;WAAWA,MAAAA,EAAAA,QAAAA;WAAsCA,KAAAA,EAAAA,OAAAA;EAAuB,SAAA,QAAA,EAAA,UAAA;EAE1FE,SAAAA,QAAAA,EAAAA,UAAkB;EAAA,SAAA,OAAA,EAAA,SAAA;;AAKhBJ,KAPPE,uBAAAA,GAOOF,CAAAA,OAP2BE,uBAO3BF,CAAAA,CAAAA,MAAAA,OAPiEE,uBAOjEF,CA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B,QAAA,EAAA;MAOc,EAAA,EAAA,MAAA;MAMjB,IAAA,EAAA,MAAA;MAiBjB,WAAA,CAAA,EAAA,MAAA;IAUA,CAAA,EAAA;;EAWO,kBAAA,CAAA,KAAA,EAAA;;;;QAtb8E;;;;;;;;;;;;;MAarF;;;;;;;;;WAgCK;;;MAGL,QAAQ;;;;;;;WAaH;;;;MAIL;;;;;WASK;;;;cAIG;;;MAGR;;;;;WAaK;;;MAGL,QAAQ;;;WAQH;;MAEL,QAAQ;;;WASH;;;MAGL;;sBAQsB,QAAQ;;;;;MAc9B;;;;;;;;;;;MAiBA;;;;;;;;;;;;eAkBS;;MAET;;;;;;;;;;;MAcA;;;0CAY0C;;;;;;;;;;;MAU1C;;;;;;;;;;MASA;;;;;;;;;;;;MAWA;;;;;;;;;;;MAWA;;;;;;MAUA;;;;;;;;;;MAWA;;;;;;;;;;MAaA;;;;;;;;;;;;;MAgBA;;;;;;;;;;;MAkBA;;;;;;;;;;;;;;;;;;;;;;;;MAsBA;;;;;;;;;;;;MAsBA;;;;wDAYwD;;;;uCAWjB;;;;;;;;;;;oBAOnB;;;;;;;;kCAOc;;;iBAMjB;;;;;;;;;;;;MAiBjB;;;;MAUA;;;;;MAWA"}
1
+ {"version":3,"file":"index.d.ts","names":["PERMISSION_CATALOG","Record","TENANT_ALLOWED_SUBJECTS","TenantAllowedSubject","ResourceScope","RESOURCE_SCOPES","AccessLevel","ScopedAccess","AllScopedAccess","ResourceScope","DEFAULT_INTEGRATIONS","IntegrationVisibility","INTEGRATION_VISIBILITIES","IntegrationScope","INTEGRATION_SCOPES","IntegrationDesiredStatus","INTEGRATION_DESIRED_STATUSES","IntegrationActualStatus","INTEGRATION_ACTUAL_STATUSES","IntegrationInstall","Record","AgentIntegration","OrgIntegration","IntegrationConfigSchemaField","IntegrationConfigResult","RegistryEntry","ResourceScope","SecretScope","SECRET_SCOPES","EncryptedEnvelopeV1","SecretMetadata","SecretEnvelopeResponse","ScopeInfo","GeneratedDataKey"],"sources":["../../../packages-internal/types/dist/access.d.ts","../../../packages-internal/types/dist/integration.d.ts","../../../packages-internal/types/dist/secrets.d.ts","../src/index.ts"],"sourcesContent":["/**\n * Runtime catalog of declared permission subjects + allowed actions.\n *\n * Mirrors the compile-time `PermissionDefinitions` augmentation in\n * `@alfe/api-core/auriclabs-roles.ts`. Kept here so browser code\n * (dashboard) can consume it without pulling in server-only deps\n * (`@middy/core`, `aws-lambda`, etc.).\n */\nexport declare const PERMISSION_CATALOG: Record<string, readonly string[]>;\n/**\n * Subjects a tenant may grant via a custom role.\n *\n * Excludes `all` (platform-admin escape hatch) and `admin_*` subjects.\n */\nexport declare const TENANT_ALLOWED_SUBJECTS: readonly [\"agent\", \"sync\", \"integration\", \"secret\", \"database\", \"template\", \"org_file\", \"team\", \"project\", \"model_policy\", \"role_management\", \"billing\", \"identity\", \"token\", \"user\", \"gateway\", \"voice\"];\nexport type TenantAllowedSubject = (typeof TENANT_ALLOWED_SUBJECTS)[number];\n/**\n * The four resource scopes at which a permission can apply.\n * Order is meaningful: broader scopes first (`org`) → narrower last (`agent`).\n *\n * `IntegrationScope` in integration.ts and `SecretScope` in secrets.ts are\n * intentional aliases of this same enum — there is only one concept of\n * \"scope\" in Alfe.\n */\nexport declare const ResourceScope: {\n readonly Org: \"org\";\n readonly Team: \"team\";\n readonly Project: \"project\";\n readonly Agent: \"agent\";\n};\nexport type ResourceScope = (typeof ResourceScope)[keyof typeof ResourceScope];\n/** Ordered tuple of resource scope string values (broad → narrow). */\nexport declare const RESOURCE_SCOPES: readonly [\"agent\" | \"team\" | \"project\" | \"org\", ...(\"agent\" | \"team\" | \"project\" | \"org\")[]];\nexport declare const AccessLevel: {\n readonly None: \"none\";\n readonly Read: \"read\";\n readonly Write: \"write\";\n readonly Manage: \"manage\";\n};\nexport type AccessLevel = (typeof AccessLevel)[keyof typeof AccessLevel];\nexport interface ScopedAccess {\n scope: ResourceScope;\n scopeId: string;\n accessLevel: AccessLevel;\n /** Resolved role label (e.g. \"org_admin\", \"team_member\") */\n role: string;\n}\nexport interface AllScopedAccess {\n orgAccess: ScopedAccess;\n teamAccess: ScopedAccess[];\n projectAccess: ScopedAccess[];\n}\n//# sourceMappingURL=access.d.ts.map","import { ResourceScope } from \"./access.js\";\n/** Integrations auto-installed for ALL agents regardless of hosting type. Cannot be removed. */\nexport declare const DEFAULT_INTEGRATIONS: readonly string[];\n/** Controls where an integration appears: public (everyone), hidden (nowhere) */\nexport declare const IntegrationVisibility: {\n readonly Public: \"public\";\n readonly Hidden: \"hidden\";\n};\nexport type IntegrationVisibility = (typeof IntegrationVisibility)[keyof typeof IntegrationVisibility];\nexport declare const INTEGRATION_VISIBILITIES: readonly [\"public\" | \"hidden\", ...(\"public\" | \"hidden\")[]];\n/** Scope at which an integration is installed */\nexport declare const IntegrationScope: {\n readonly Org: \"org\";\n readonly Team: \"team\";\n readonly Project: \"project\";\n readonly Agent: \"agent\";\n};\nexport type IntegrationScope = ResourceScope;\nexport declare const INTEGRATION_SCOPES: readonly [\"agent\" | \"team\" | \"project\" | \"org\", ...(\"agent\" | \"team\" | \"project\" | \"org\")[]];\nexport declare const IntegrationDesiredStatus: {\n readonly Active: \"active\";\n readonly Removed: \"removed\";\n};\nexport type IntegrationDesiredStatus = (typeof IntegrationDesiredStatus)[keyof typeof IntegrationDesiredStatus];\nexport declare const INTEGRATION_DESIRED_STATUSES: readonly [\"active\" | \"removed\", ...(\"active\" | \"removed\")[]];\nexport declare const IntegrationActualStatus: {\n readonly Installing: \"installing\";\n readonly Active: \"active\";\n readonly Error: \"error\";\n readonly Removing: \"removing\";\n readonly Inactive: \"inactive\";\n readonly Unknown: \"unknown\";\n};\nexport type IntegrationActualStatus = (typeof IntegrationActualStatus)[keyof typeof IntegrationActualStatus];\nexport declare const INTEGRATION_ACTUAL_STATUSES: readonly [\"active\" | \"error\" | \"installing\" | \"removing\" | \"inactive\" | \"unknown\", ...(\"active\" | \"error\" | \"installing\" | \"removing\" | \"inactive\" | \"unknown\")[]];\nexport interface IntegrationInstall {\n scope: IntegrationScope;\n scopeId: string;\n integrationId: string;\n tenantId: string;\n desiredStatus: IntegrationDesiredStatus;\n actualStatus: IntegrationActualStatus;\n version: string;\n config: Record<string, unknown>;\n errorMessage: string;\n installedAt: string;\n updatedAt: string;\n}\n/** @deprecated Use IntegrationInstall instead */\nexport type AgentIntegration = IntegrationInstall;\n/** Org-scoped integration install */\nexport type OrgIntegration = IntegrationInstall;\nexport interface IntegrationConfigSchemaField {\n key: string;\n label: string;\n type: string;\n description?: string;\n required?: boolean;\n default?: string | number | boolean;\n options?: string[];\n select_options?: {\n value: string;\n label: string;\n }[];\n oauth_provider?: string;\n oauth_scopes?: string[];\n oauth_integration_id?: string;\n editable?: string;\n hidden?: boolean;\n}\nexport interface IntegrationConfigResult {\n integrationId: string;\n config: Record<string, unknown>;\n configSchema: IntegrationConfigSchemaField[];\n}\nexport interface RegistryEntry {\n id: string;\n name: string;\n description: string;\n versions: string[];\n latest: string;\n repository: string;\n commit: string;\n icon?: string;\n author?: {\n name: string;\n url?: string;\n } | string;\n pricing?: {\n type: \"free\" | \"paid\" | \"usage\";\n price?: number;\n currency?: string;\n interval?: \"month\" | \"year\";\n description?: string;\n };\n features?: string[];\n preview_images?: string[];\n config_schema?: IntegrationConfigSchemaField[];\n supported_agents?: string[];\n /** Scopes where this integration can be installed */\n supported_scopes?: IntegrationScope[];\n /** Visibility status — controls where integration appears */\n visibility?: IntegrationVisibility;\n}\n//# sourceMappingURL=integration.d.ts.map","/**\n * Secrets types — shared between services/secrets, @alfe.ai/agent-api-client,\n * the openclaw-secrets plugin, and dashboard clients.\n *\n * Server-side crypto and KMS glue live in @alfe/secret-store (Node/AWS-only);\n * this module is a pure, dependency-free shape contract safe for every\n * environment the agent-api-client ships to.\n */\nimport type { ResourceScope } from \"./access.js\";\n/** Scope levels at which a secret can be owned. Aliased to ResourceScope. */\nexport type SecretScope = ResourceScope;\nexport declare const SECRET_SCOPES: readonly [\"agent\" | \"team\" | \"project\" | \"org\", ...(\"agent\" | \"team\" | \"project\" | \"org\")[]];\n/**\n * v1 encrypted envelope as persisted by services/secrets and exchanged with\n * agents. Values are AES-256-GCM ciphertext; iv/authTag/ciphertext/dataKeyCiphertext\n * are all base64-encoded.\n */\nexport interface EncryptedEnvelopeV1 {\n version: 1;\n iv: string;\n ciphertext: string;\n authTag: string;\n dataKeyCiphertext: string;\n}\n/** Opaque metadata about a secret row — never includes plaintext. */\nexport interface SecretMetadata {\n secretId: string;\n secretName: string;\n description?: string;\n tags?: string[];\n createdAt: string;\n updatedAt: string;\n rotatedAt?: string;\n}\n/** A single secret row including its encrypted envelope. */\nexport interface SecretEnvelopeResponse extends SecretMetadata {\n envelope: EncryptedEnvelopeV1;\n}\n/** A scope the caller can read or write secrets in. */\nexport interface ScopeInfo {\n scope: SecretScope;\n scopeId: string;\n name?: string;\n}\n/**\n * KMS-issued data key, returned by the secrets service's\n * `/secrets/generate-data-key` KMS proxy endpoint. The plaintext key is\n * returned base64-encoded; callers MUST decode it to a Buffer and zero the\n * Buffer after use — never keep the plaintext as a JS string.\n */\nexport interface GeneratedDataKey {\n plaintextKey: string;\n dataKeyCiphertext: string;\n}\n//# sourceMappingURL=secrets.d.ts.map"],"mappings":";;ACWA;AAMA;AAEA;AAIA;;;;;AAEqBiB,cDDAb,aCQpB,EAAA;EACWa,SAAAA,GAAAA,EAAAA,KAAAA;EAAuB,SAAA,IAAA,EAAA,MAAA;WAAWA,OAAAA,EAAAA,SAAAA;WAAsCA,KAAAA,EAAAA,OAAAA;CAAuB;AAE1FE,KDLLf,aAAAA,GCKuB,CAAA,ODLCA,aCKD,CAAA,CAAA,MAAA,ODL6BA,aCK7B,CAAA;;;;;ADLCA,cC1BfO,qBD0BeP,EAAAA;WAA4BA,MAAAA,EAAAA,QAAAA;EAAa,SAAA,MAAA,EAAA,QAAA;;KCtBjEO,qBAAAA,WAAgCA,oCAAoCA;AAJhF;AAIYA,cAGSE,gBAHY,EAAA;EAAA,SAAA,GA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BA;;;;wDAYwD;;;;uCAWjB;;;;;;;;;;;oBAOnB;;;;;;;;kCAOc;;;iBAMjB;;;;;;;;;;;;MAiBjB;;;;MAUA;;;;;MAWA;iCASiC;;;;;;;;;;;MAcjC"}
package/dist/index.js CHANGED
@@ -1,4 +1,11 @@
1
1
  //#region src/index.ts
2
+ /**
3
+ * Encode each path segment but keep the `/` separators — `encodeURIComponent`
4
+ * would escape the slashes too, breaking greedy proxy routes.
5
+ */
6
+ function encodeFilePath(filePath) {
7
+ return filePath.split("/").map(encodeURIComponent).join("/");
8
+ }
2
9
  var AgentApiClient = class {
3
10
  apiKey;
4
11
  apiUrl;
@@ -21,6 +28,57 @@ var AgentApiClient = class {
21
28
  }
22
29
  return (await res.json()).data;
23
30
  }
31
+ async syncRegister(args) {
32
+ return this.request("/agents/sync/register", {
33
+ method: "POST",
34
+ body: JSON.stringify(args ?? {})
35
+ });
36
+ }
37
+ async syncGetManifest() {
38
+ return this.request("/agents/sync/manifest");
39
+ }
40
+ async syncPresign(args) {
41
+ return this.request("/agents/sync/presign", {
42
+ method: "POST",
43
+ body: JSON.stringify(args)
44
+ });
45
+ }
46
+ async syncConfirmUpload(args) {
47
+ return this.request("/agents/sync/confirm", {
48
+ method: "POST",
49
+ body: JSON.stringify(args)
50
+ });
51
+ }
52
+ async syncReconstruct(args) {
53
+ return this.request("/agents/sync/reconstruct", {
54
+ method: "POST",
55
+ body: JSON.stringify(args)
56
+ });
57
+ }
58
+ async syncGetStats() {
59
+ return this.request("/agents/sync/stats");
60
+ }
61
+ async syncListFiles(args) {
62
+ const qs = new URLSearchParams();
63
+ if (args?.prefix) qs.set("prefix", args.prefix);
64
+ const query = qs.toString();
65
+ return this.request(`/agents/sync/files${query ? `?${query}` : ""}`);
66
+ }
67
+ async syncListSessions() {
68
+ return this.request("/agents/sync/sessions");
69
+ }
70
+ async syncGetSession(sessionId) {
71
+ return this.request(`/agents/sync/sessions/${encodeURIComponent(sessionId)}`);
72
+ }
73
+ async syncDeleteFile(filePath) {
74
+ return this.request(`/agents/sync/files/${encodeFilePath(filePath)}`, { method: "DELETE" });
75
+ }
76
+ async sharedListFiles(args) {
77
+ return this.request(`/agents/org/files/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}`);
78
+ }
79
+ async sharedDownloadUrl(args) {
80
+ return this.request(`/agents/org/files/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/download/${encodeFilePath(args.filePath)}`);
81
+ }
24
82
  async listIntegrations() {
25
83
  return this.request("/agent/integrations");
26
84
  }
@@ -169,26 +227,11 @@ var AgentApiClient = class {
169
227
  body: JSON.stringify(args)
170
228
  });
171
229
  }
172
- async enforcePolicy(args) {
173
- return this.request("/agent/identity/enforce", {
174
- method: "POST",
175
- body: JSON.stringify(args)
176
- });
177
- }
178
- async checkToolPermission(args) {
179
- return this.request("/agent/identity/check-tool", {
180
- method: "POST",
181
- body: JSON.stringify(args)
182
- });
183
- }
184
230
  async searchIdentities(args) {
185
231
  const qs = new URLSearchParams();
186
232
  if (args?.q) qs.set("q", args.q);
187
233
  if (args?.status) qs.set("status", args.status);
188
- if (args?.tag) qs.set("tag", args.tag);
189
- if (args?.platform) qs.set("platform", args.platform);
190
234
  if (args?.limit) qs.set("limit", String(args.limit));
191
- if (args?.offset) qs.set("offset", String(args.offset));
192
235
  const query = qs.toString();
193
236
  return this.request(`/agent/identity/search${query ? `?${query}` : ""}`);
194
237
  }
@@ -222,7 +265,6 @@ var AgentApiClient = class {
222
265
  async getIdentityChangelog(identityId, args) {
223
266
  const qs = new URLSearchParams();
224
267
  if (args?.limit) qs.set("limit", String(args.limit));
225
- if (args?.offset) qs.set("offset", String(args.offset));
226
268
  const query = qs.toString();
227
269
  return this.request(`/agent/identity/${encodeURIComponent(identityId)}/changelog${query ? `?${query}` : ""}`);
228
270
  }
@@ -244,6 +286,29 @@ var AgentApiClient = class {
244
286
  body: JSON.stringify(args)
245
287
  });
246
288
  }
289
+ /**
290
+ * Update display-shape fields on an Identity. Body excludes `email` /
291
+ * `phone` / `title` / `company` / `metadata` per Section D4 — contacts go
292
+ * via the verify flow, title/company live on OrgMembership, metadata is
293
+ * not agent-writable.
294
+ */
295
+ async updateIdentity(identityId, args) {
296
+ return this.request(`/agent/identity/${encodeURIComponent(identityId)}/update`, {
297
+ method: "POST",
298
+ body: JSON.stringify(args)
299
+ });
300
+ }
301
+ /**
302
+ * Phase 2 (Section H): server-side verification of a Google Chat sender via
303
+ * the agent's existing Google OAuth credentials. Returns the resolved
304
+ * identity (created or matched via Scenario-B email enrichment).
305
+ */
306
+ async resolveGoogleChatSender(args) {
307
+ return this.request("/agent/google/resolve-sender", {
308
+ method: "POST",
309
+ body: JSON.stringify(args)
310
+ });
311
+ }
247
312
  async memorySearch(query, opts) {
248
313
  return this.request("/agent/memory/search", {
249
314
  method: "POST",
@@ -317,6 +382,15 @@ var AgentApiClient = class {
317
382
  body: JSON.stringify(params)
318
383
  });
319
384
  }
385
+ async registerDatabaseCredentials() {
386
+ return this.request("/agent/database/register", { method: "POST" });
387
+ }
388
+ async reportDatabaseAudit(entry) {
389
+ await this.request("/agent/database/audit", {
390
+ method: "POST",
391
+ body: JSON.stringify(entry)
392
+ }).catch(() => {});
393
+ }
320
394
  };
321
395
  //#endregion
322
396
  export { AgentApiClient };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @alfe.ai/agent-api-client — Agent self-service API client.\n *\n * Used by agents calling /agent/ endpoints. The agent authenticates\n * with its API key — the backend resolves agentId + tenantId from the token.\n * No agent ID needed in paths or config.\n */\n\nexport type {\n IntegrationInstall,\n IntegrationConfigResult,\n RegistryEntry,\n IntegrationConfigSchemaField,\n SecretScope,\n EncryptedEnvelopeV1,\n SecretMetadata,\n SecretEnvelopeResponse,\n ScopeInfo,\n GeneratedDataKey,\n} from \"@alfe/types\";\n\nimport type {\n IntegrationInstall,\n IntegrationConfigResult,\n RegistryEntry,\n SecretScope,\n EncryptedEnvelopeV1,\n SecretMetadata,\n SecretEnvelopeResponse,\n ScopeInfo,\n GeneratedDataKey,\n} from \"@alfe/types\";\n\nexport interface AgentApiClientConfig {\n apiKey: string;\n apiUrl: string;\n}\n\nexport class AgentApiClient {\n private readonly apiKey: string;\n private readonly apiUrl: string;\n\n constructor(config: AgentApiClientConfig) {\n this.apiKey = config.apiKey;\n this.apiUrl = config.apiUrl;\n }\n\n private async request<T>(path: string, options?: RequestInit): Promise<T> {\n const url = `${this.apiUrl}${path}`;\n const headers = new Headers(options?.headers);\n headers.set(\"Authorization\", `Bearer ${this.apiKey}`);\n headers.set(\"Content-Type\", \"application/json\");\n\n const res = await fetch(url, { ...options, headers });\n\n if (!res.ok) {\n await res.text(); // drain body\n throw new Error(`Agent API request failed (${String(res.status)})`);\n }\n\n const body = (await res.json()) as { data: T };\n return body.data;\n }\n\n async listIntegrations(): Promise<IntegrationInstall[]> {\n return this.request<IntegrationInstall[]>(\"/agent/integrations\");\n }\n\n async getIntegrationConfig(integrationId: string): Promise<IntegrationConfigResult> {\n return this.request<IntegrationConfigResult>(\n `/agent/integrations/${encodeURIComponent(integrationId)}/config`,\n );\n }\n\n async updateIntegrationConfig(\n integrationId: string,\n config: Record<string, unknown>,\n ): Promise<void> {\n await this.request<unknown>(\n `/agent/integrations/${encodeURIComponent(integrationId)}`,\n {\n method: \"PATCH\",\n body: JSON.stringify({ config }),\n },\n );\n }\n\n async installIntegration(\n integrationId: string,\n options?: { version?: string; config?: Record<string, unknown> },\n ): Promise<IntegrationInstall> {\n return this.request<IntegrationInstall>(\"/agent/integrations\", {\n method: \"POST\",\n body: JSON.stringify({\n integrationId,\n version: options?.version,\n config: options?.config,\n }),\n });\n }\n\n async removeIntegration(integrationId: string): Promise<IntegrationInstall> {\n return this.request<IntegrationInstall>(\n `/agent/integrations/${encodeURIComponent(integrationId)}`,\n { method: \"DELETE\" },\n );\n }\n\n async getOAuthUrl(\n provider: string,\n scopes?: string[],\n ): Promise<{ url: string; provider: string; expiresIn: number }> {\n const params = new URLSearchParams({ provider });\n if (scopes?.length) params.set(\"scopes\", scopes.join(\",\"));\n return this.request(`/agent/integrations/oauth/url?${params.toString()}`);\n }\n\n async getOAuthStatus(\n provider: string,\n ): Promise<{ provider: string; connected: boolean; config?: Record<string, string> }> {\n return this.request(\n `/agent/integrations/oauth/status?provider=${encodeURIComponent(provider)}`,\n );\n }\n\n async getRegistry(): Promise<{ integrations: RegistryEntry[] }> {\n return this.request<{ integrations: RegistryEntry[] }>(\"/integrations/registry\");\n }\n\n async getGoogleCredentials(): Promise<{\n accounts?: {\n email: string;\n refreshToken: string;\n clientId: string;\n clientSecret: string;\n enabledServices?: string[];\n isDefault: boolean;\n displayName?: string;\n }[];\n email: string;\n refreshToken: string;\n clientId: string;\n clientSecret: string;\n projectId: string;\n enabledServices?: string[];\n }> {\n return this.request(\"/agent/google/credentials\");\n }\n\n async disconnectGoogleAccount(email: string): Promise<{\n accounts: { email: string; displayName?: string; isDefault: boolean }[];\n }> {\n return this.request(`/agent/google/accounts/${encodeURIComponent(email)}`, {\n method: \"DELETE\",\n });\n }\n\n async setDefaultGoogleAccount(email: string): Promise<{\n accounts: { email: string; displayName?: string; isDefault: boolean }[];\n }> {\n return this.request(`/agent/google/accounts/${encodeURIComponent(email)}/default`, {\n method: \"PUT\",\n });\n }\n\n async getGoogleChatCredentials(): Promise<{\n email: string;\n refreshToken: string;\n clientId: string;\n clientSecret: string;\n displayName?: string;\n }> {\n return this.request(\"/agent/google-chat/credentials\");\n }\n\n async getGithubCredentials(): Promise<{\n login: string;\n accessToken: string;\n }> {\n return this.request(\"/agent/github/credentials\");\n }\n\n async getXeroCredentials(): Promise<{\n accessToken: string;\n accessTokenExpiresAt: string;\n xeroTenantId: string;\n }> {\n return this.request(\"/agent/xero/credentials\");\n }\n\n async refreshXeroToken(): Promise<{\n accessToken: string;\n expiresAt: string;\n }> {\n return this.request(\"/agent/xero/token\", { method: \"POST\" });\n }\n\n async getNotionCredentials(): Promise<{\n accessToken: string;\n workspaceId: string;\n workspaceName: string;\n }> {\n return this.request(\"/agent/notion/credentials\");\n }\n\n async getAtlassianCredentials(): Promise<{\n accessToken: string;\n refreshToken: string;\n accessTokenExpiresAt: string;\n cloudId: string;\n siteName: string;\n siteUrl: string;\n email: string;\n enabledProducts: string[];\n clientId: string;\n clientSecret: string;\n }> {\n return this.request(\"/agent/atlassian/credentials\");\n }\n\n async refreshAtlassianToken(): Promise<{\n accessToken: string;\n expiresAt: string;\n }> {\n return this.request(\"/agent/atlassian/token\", { method: \"POST\" });\n }\n\n async getMYOBCredentials(): Promise<{\n accessToken: string;\n accessTokenExpiresAt: string;\n myobBusinessId: string;\n clientId: string;\n }> {\n return this.request(\"/agent/myob/credentials\");\n }\n\n async refreshMYOBToken(): Promise<{\n accessToken: string;\n expiresAt: string;\n }> {\n return this.request(\"/agent/myob/token\", { method: \"POST\" });\n }\n\n async getTeamsCredentials(): Promise<{\n agentId: string;\n tenantId: string;\n azureAppId: string;\n azureBotId: string;\n azureClientSecret: string;\n botDisplayName?: string;\n teamsTenantId?: string;\n serviceUrl?: string;\n }> {\n return this.request(\"/agent/microsoft/credentials\");\n }\n\n async sendTeamsMessage(data: {\n conversationId: string;\n text?: string;\n adaptiveCard?: Record<string, unknown>;\n }): Promise<{ ok: boolean; activityId: string }> {\n return this.request(\"/agent/microsoft/send\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n }\n\n async listTeamsChannels(): Promise<{\n channels: { id: string; name: string; description?: string }[];\n }> {\n return this.request(\"/agent/microsoft/channels\");\n }\n\n async presignAttachments(files: { filename: string; mimeType: string; size: number }[]): Promise<{\n attachments: { id: string; uploadUrl: string; downloadUrl: string; s3Key: string; expiresAt: string }[];\n }> {\n return this.request(\"/agent/chat/attachments/presign\", {\n method: \"POST\",\n body: JSON.stringify({ files }),\n });\n }\n\n async recordActivity(data: {\n userId?: string;\n channel: string;\n role: \"user\" | \"assistant\";\n }): Promise<{ recorded: boolean }> {\n return this.request<{ recorded: boolean }>(\"/agent/activity\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n }\n\n // ─── Secrets ──────────────────────────────────────────────────\n //\n // Envelope CRUD + KMS proxy for per-scope encrypted secret storage.\n // Agents never hold a KMS master key — these proxy endpoints mint one-shot\n // AES-256 data keys bound (via KMS encryption context) to\n // `{ tenantId, scope, scopeId, secretId }`. The agent performs AES-256-GCM\n // locally; the backend only ever sees opaque envelopes.\n //\n // Routes resolve to the agent API gateway (mapping key `agent`), where\n // services/secrets registers its routes with pathPrefix `/secrets`. With\n // `apiUrl` set to the host root (e.g. `https://api.alfe.ai`), the full URL\n // is `https://api.alfe.ai/agent/secrets/...`. This is the same mapping as\n // `/agent/integrations/...` etc. — do NOT hit `/secrets/...` on the root\n // host: that's the user-auth dashboard gateway, which rejects agent tokens.\n //\n // `plaintextKey` in responses is base64 — callers MUST decode to a Node\n // `Buffer` immediately and zero it after use. NEVER keep plaintext keys\n // as JS strings (strings are immutable and cannot be wiped).\n\n /**\n * Mint a fresh AES-256 data key for a new secret or rotation. The encryption\n * context is rebuilt server-side from `auth.tenantId` + the body fields; the\n * agent cannot forge context for a scope it doesn't own.\n */\n async generateSecretDataKey(args: {\n scope: SecretScope;\n scopeId: string;\n secretId: string;\n }): Promise<GeneratedDataKey> {\n return this.request<GeneratedDataKey>(\"/agent/secrets/generate-data-key\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n /**\n * Unwrap a wrapped data key so the agent can decrypt the envelope locally.\n * KMS Decrypt will fail with `InvalidCiphertextException` if the envelope\n * was tampered with in a way that changes `{ tenantId, scope, scopeId, secretId }`.\n */\n async decryptSecretDataKey(args: {\n scope: SecretScope;\n scopeId: string;\n secretId: string;\n dataKeyCiphertext: string;\n }): Promise<{ plaintextKey: string }> {\n return this.request<{ plaintextKey: string }>(\"/agent/secrets/decrypt-data-key\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n /** Upload a pre-encrypted envelope for a secret. */\n async putSecretEnvelope(args: {\n scope: SecretScope;\n scopeId: string;\n secretId: string;\n secretName: string;\n envelope: EncryptedEnvelopeV1;\n description?: string;\n tags?: string[];\n }): Promise<{ secretId: string }> {\n const { scope, scopeId, secretId, ...body } = args;\n return this.request<{ secretId: string }>(\n `/agent/secrets/${encodeURIComponent(scope)}/${encodeURIComponent(scopeId)}/${encodeURIComponent(secretId)}`,\n {\n method: \"PUT\",\n body: JSON.stringify(body),\n },\n );\n }\n\n /** Fetch the encrypted envelope for a single secret. */\n async getSecretEnvelope(args: {\n scope: SecretScope;\n scopeId: string;\n secretId: string;\n }): Promise<SecretEnvelopeResponse> {\n return this.request<SecretEnvelopeResponse>(\n `/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/${encodeURIComponent(args.secretId)}`,\n );\n }\n\n /** List metadata (never envelopes) for secrets in a scope. */\n async listSecrets(args: {\n scope: SecretScope;\n scopeId: string;\n }): Promise<SecretMetadata[]> {\n const resp = await this.request<{ secrets: SecretMetadata[] }>(\n `/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}`,\n );\n return resp.secrets;\n }\n\n /** Delete a secret. */\n async deleteSecret(args: {\n scope: SecretScope;\n scopeId: string;\n secretId: string;\n }): Promise<void> {\n await this.request<unknown>(\n `/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/${encodeURIComponent(args.secretId)}`,\n { method: \"DELETE\" },\n );\n }\n\n /** Enumerate scopes (org/team/project/agent) this agent can access. */\n async listSecretScopes(): Promise<ScopeInfo[]> {\n const resp = await this.request<{ scopes: ScopeInfo[] }>(\"/agent/secrets/scopes\");\n return resp.scopes;\n }\n\n // ─── Identity ─────────────────────────────────────────────\n //\n // Identity resolution, permission enforcement, and CRM tools.\n // The agent API derives tenantId + agentId from the agent token.\n\n async resolveIdentity(args: {\n platform: string;\n platformId: string;\n displayName?: string;\n }): Promise<{\n identityId: string | null;\n status: string;\n accessAllowed: boolean;\n created?: boolean;\n reason?: string;\n }> {\n return this.request(\"/agent/identity/resolve\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async enforcePolicy(args: {\n platform: string;\n senderId: string;\n channelId?: string;\n }): Promise<{\n identityId: string | null;\n orgId: string | null;\n role: string | null;\n allowedTools: string[];\n deniedTools: string[];\n identified: boolean;\n }> {\n return this.request(\"/agent/identity/enforce\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async checkToolPermission(args: {\n platform: string;\n senderId: string;\n toolName: string;\n toolArgs?: Record<string, unknown>;\n channelId?: string;\n }): Promise<{ allowed: boolean; reason?: string }> {\n return this.request(\"/agent/identity/check-tool\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async searchIdentities(args?: {\n q?: string;\n status?: string;\n tag?: string;\n platform?: string;\n limit?: number;\n offset?: number;\n }): Promise<{ identities: unknown[] }> {\n const qs = new URLSearchParams();\n if (args?.q) qs.set(\"q\", args.q);\n if (args?.status) qs.set(\"status\", args.status);\n if (args?.tag) qs.set(\"tag\", args.tag);\n if (args?.platform) qs.set(\"platform\", args.platform);\n if (args?.limit) qs.set(\"limit\", String(args.limit));\n if (args?.offset) qs.set(\"offset\", String(args.offset));\n const query = qs.toString();\n return this.request(`/agent/identity/search${query ? `?${query}` : \"\"}`);\n }\n\n async getIdentityContext(identityId: string): Promise<{\n identity: unknown;\n recentChanges: unknown[];\n }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/context`);\n }\n\n async mergeIdentities(survivorId: string, args: {\n mergedId: string;\n changedBy: { type: string; id: string; name?: string };\n }): Promise<{ ok: boolean; error?: string }> {\n return this.request(`/agent/identity/${encodeURIComponent(survivorId)}/merge`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async unmergeIdentity(identityId: string, args: {\n changedBy: { type: string; id: string; name?: string };\n }): Promise<{ ok: boolean; error?: string }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/unmerge`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async addIdentityNote(identityId: string, args: {\n content: string;\n category?: string;\n changedBy: { type: string; id: string; name?: string };\n }): Promise<{ noteId: string | null }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/notes`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async tagIdentity(identityId: string, args: {\n tag: string;\n action: \"add\" | \"remove\";\n changedBy: { type: string; id: string; name?: string };\n }): Promise<{ ok: boolean }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/tags`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async getIdentityChangelog(identityId: string, args?: {\n limit?: number;\n offset?: number;\n }): Promise<{ entries: unknown[] }> {\n const qs = new URLSearchParams();\n if (args?.limit) qs.set(\"limit\", String(args.limit));\n if (args?.offset) qs.set(\"offset\", String(args.offset));\n const query = qs.toString();\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/changelog${query ? `?${query}` : \"\"}`);\n }\n\n async rollbackIdentity(identityId: string, args: {\n targetVersion: number;\n changedBy: { type: string; id: string; name?: string };\n }): Promise<{ ok: boolean; entry?: unknown }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/rollback`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async requestIdentityVerification(args: {\n claimedIdentityId: string;\n requestingIdentityId: string;\n requestingPlatform: string;\n requestingPlatformId: string;\n preferredChannel?: \"sms\" | \"email\";\n }): Promise<{\n verificationId: string;\n channel: string;\n deliveredTo: string;\n expiresAt: string;\n availableChannels: { channel: string; deliveredTo: string }[];\n }> {\n return this.request(\"/agent/identity/verify/request\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async confirmIdentityVerification(args: {\n verificationId: string;\n phrase: string;\n }): Promise<{ verified: boolean; identityId?: string; error?: string }> {\n return this.request(\"/agent/identity/verify/confirm\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n // ─── Memory ──────────────────────────────────────────────\n //\n // Cloud memory (Turbopuffer vectors + DynamoDB knowledge graph).\n // The agent API derives tenantId + agentId from the agent token.\n\n async memorySearch(query: string, opts?: {\n limit?: number;\n topic?: string;\n subtopic?: string;\n tag?: string;\n includeKnowledge?: boolean;\n }): Promise<{\n facts: { subject: string; predicate: string; object: string; since: string; confidence: number }[];\n memories: { id: string; text: string; topic: string; subtopic: string; tag: string; importance: number; timestamp: number; score: number }[];\n }> {\n return this.request(\"/agent/memory/search\", {\n method: \"POST\",\n body: JSON.stringify({\n query,\n limit: opts?.limit ?? 10,\n topic: opts?.topic,\n subtopic: opts?.subtopic,\n tag: opts?.tag,\n includeKnowledge: opts?.includeKnowledge ?? true,\n }),\n });\n }\n\n async memoryStore(text: string, opts?: {\n topic?: string;\n subtopic?: string;\n tag?: string;\n importance?: number;\n }): Promise<{ memoryId: string }> {\n return this.request(\"/agent/memory/store\", {\n method: \"POST\",\n body: JSON.stringify({\n text,\n topic: opts?.topic ?? \"general\",\n subtopic: opts?.subtopic ?? \"general\",\n tag: opts?.tag ?? \"fact\",\n importance: opts?.importance ?? 0.7,\n }),\n });\n }\n\n async memoryIngest(sessionKey: string, messages: {\n role: string;\n content: string;\n index: number;\n timestamp?: string;\n }[], metadata?: {\n channelId?: string;\n userId?: string;\n userName?: string;\n }): Promise<{ queued: boolean; messageCount: number }> {\n return this.request(\"/agent/memory/ingest\", {\n method: \"POST\",\n body: JSON.stringify({\n sessionKey,\n lastProcessedIndex: messages.length > 0 ? messages[messages.length - 1].index : -1,\n messages,\n metadata,\n }),\n });\n }\n\n async memoryLoadContext(tier?: number, topicHint?: string): Promise<{\n formatted: string;\n [key: string]: unknown;\n }> {\n const params = new URLSearchParams();\n if (tier !== undefined) params.set(\"tier\", String(tier));\n if (topicHint) params.set(\"topicHint\", topicHint);\n const qs = params.toString();\n return this.request(`/agent/memory/context${qs ? `?${qs}` : \"\"}`);\n }\n\n async memoryLookupEntity(subject: string): Promise<{\n subject: string;\n triples: { tripleId: string; predicate: string; object: string; validFrom: string; validTo?: string; confidence: number }[];\n }> {\n return this.request(`/agent/memory/knowledge/entities?subject=${encodeURIComponent(subject)}`);\n }\n\n async memoryNavigate(): Promise<{\n topics: { name: string; tripleCount: number; subtopics: string[] }[];\n cursor: string | null;\n }> {\n return this.request(\"/agent/memory/navigate\");\n }\n\n async memoryDelete(memoryId: string): Promise<{ deleted: boolean }> {\n return this.request(`/agent/memory/${encodeURIComponent(memoryId)}`, {\n method: \"DELETE\",\n });\n }\n\n async memoryStats(): Promise<{\n vectorCount: number;\n tripleCount: number;\n storageEstimateBytes: number;\n lastIngestionAt?: string;\n }> {\n return this.request(\"/agent/memory/stats\");\n }\n\n // ─── Search ──────────────────────────────────────────────\n\n async searchWeb(params: {\n query: string;\n count?: number;\n offset?: number;\n country?: string;\n freshness?: string;\n }): Promise<unknown> {\n return this.request(\"/agent/search/web\", {\n method: \"POST\",\n body: JSON.stringify(params),\n });\n }\n\n async searchImages(params: {\n query: string;\n count?: number;\n }): Promise<unknown> {\n return this.request(\"/agent/search/images\", {\n method: \"POST\",\n body: JSON.stringify(params),\n });\n }\n\n async searchNews(params: {\n query: string;\n count?: number;\n freshness?: string;\n }): Promise<unknown> {\n return this.request(\"/agent/search/news\", {\n method: \"POST\",\n body: JSON.stringify(params),\n });\n }\n}\n"],"mappings":";AAsCA,IAAa,iBAAb,MAA4B;CAC1B;CACA;CAEA,YAAY,QAA8B;AACxC,OAAK,SAAS,OAAO;AACrB,OAAK,SAAS,OAAO;;CAGvB,MAAc,QAAW,MAAc,SAAmC;EACxE,MAAM,MAAM,GAAG,KAAK,SAAS;EAC7B,MAAM,UAAU,IAAI,QAAQ,SAAS,QAAQ;AAC7C,UAAQ,IAAI,iBAAiB,UAAU,KAAK,SAAS;AACrD,UAAQ,IAAI,gBAAgB,mBAAmB;EAE/C,MAAM,MAAM,MAAM,MAAM,KAAK;GAAE,GAAG;GAAS;GAAS,CAAC;AAErD,MAAI,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;AACrD,SAAO,KAAK,QAAQ,wBAAwB;GAC1C,QAAQ;GACR,MAAM,KAAK,UAAU;IACnB;IACA,oBAAoB,SAAS,SAAS,IAAI,SAAS,SAAS,SAAS,GAAG,QAAQ;IAChF;IACA;IACD,CAAC;GACH,CAAC;;CAGJ,MAAM,kBAAkB,MAAe,WAGpC;EACD,MAAM,SAAS,IAAI,iBAAiB;AACpC,MAAI,SAAS,KAAA,EAAW,QAAO,IAAI,QAAQ,OAAO,KAAK,CAAC;AACxD,MAAI,UAAW,QAAO,IAAI,aAAa,UAAU;EACjD,MAAM,KAAK,OAAO,UAAU;AAC5B,SAAO,KAAK,QAAQ,wBAAwB,KAAK,IAAI,OAAO,KAAK;;CAGnE,MAAM,mBAAmB,SAGtB;AACD,SAAO,KAAK,QAAQ,4CAA4C,mBAAmB,QAAQ,GAAG;;CAGhG,MAAM,iBAGH;AACD,SAAO,KAAK,QAAQ,yBAAyB;;CAG/C,MAAM,aAAa,UAAiD;AAClE,SAAO,KAAK,QAAQ,iBAAiB,mBAAmB,SAAS,IAAI,EACnE,QAAQ,UACT,CAAC;;CAGJ,MAAM,cAKH;AACD,SAAO,KAAK,QAAQ,sBAAsB;;CAK5C,MAAM,UAAU,QAMK;AACnB,SAAO,KAAK,QAAQ,qBAAqB;GACvC,QAAQ;GACR,MAAM,KAAK,UAAU,OAAO;GAC7B,CAAC;;CAGJ,MAAM,aAAa,QAGE;AACnB,SAAO,KAAK,QAAQ,wBAAwB;GAC1C,QAAQ;GACR,MAAM,KAAK,UAAU,OAAO;GAC7B,CAAC;;CAGJ,MAAM,WAAW,QAII;AACnB,SAAO,KAAK,QAAQ,sBAAsB;GACxC,QAAQ;GACR,MAAM,KAAK,UAAU,OAAO;GAC7B,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @alfe.ai/agent-api-client — Agent self-service API client.\n *\n * Used by agents calling /agent/ endpoints. The agent authenticates\n * with its API key — the backend resolves agentId + tenantId from the token.\n * No agent ID needed in paths or config.\n */\n\nexport type {\n IntegrationInstall,\n IntegrationConfigResult,\n RegistryEntry,\n IntegrationConfigSchemaField,\n SecretScope,\n EncryptedEnvelopeV1,\n SecretMetadata,\n SecretEnvelopeResponse,\n ScopeInfo,\n GeneratedDataKey,\n} from \"@alfe/types\";\n\nimport type {\n IntegrationInstall,\n IntegrationConfigResult,\n RegistryEntry,\n SecretScope,\n EncryptedEnvelopeV1,\n SecretMetadata,\n SecretEnvelopeResponse,\n ScopeInfo,\n GeneratedDataKey,\n} from \"@alfe/types\";\n\nexport interface AgentApiClientConfig {\n apiKey: string;\n apiUrl: string;\n}\n\n// ─── Sync types ──────────────────────────────────────────\n\nexport interface SyncAgentInfo {\n agentId: string;\n tenantId: string;\n displayName: string;\n s3Prefix: string;\n status: \"stale\" | \"syncing\" | \"synced\";\n fileCount?: number;\n totalSize?: number;\n lastSync?: string;\n}\n\nexport interface SyncManifestEntry {\n hash: string;\n size: number;\n modified: string;\n etag?: string;\n storageClass?: string;\n compressed?: boolean;\n}\n\nexport interface SyncManifest {\n version: 1;\n agentId: string;\n lastSync: string;\n files: Record<string, SyncManifestEntry>;\n}\n\nexport interface SyncPresignedUrl {\n path: string;\n url: string;\n expiresAt: string;\n}\n\nexport interface SyncConfirmedUpload {\n filePath: string;\n hash: string;\n size: number;\n storageClass: \"STANDARD\" | \"GLACIER_IR\";\n syncedAt: string;\n}\n\nexport interface SyncReconstructFile {\n path: string;\n size: number;\n url: string;\n storageClass?: string;\n compressed?: boolean;\n}\n\nexport interface SyncReconstructBundle {\n agentId: string;\n mode: \"full\" | \"active\" | \"memory\";\n fileCount: number;\n totalSize: number;\n files: SyncReconstructFile[];\n expiresAt: string;\n}\n\nexport interface SyncAgentStats {\n agentId: string;\n standardBytes: number;\n glacierBytes: number;\n fileCount: number;\n lastSyncAt: string | null;\n}\n\nexport interface SyncFileEntry {\n filePath: string;\n size: number;\n modified: string;\n contentHash: string;\n storageClass?: string;\n compressed?: boolean;\n}\n\nexport interface SyncSessionEntry {\n sessionId: string;\n size: number;\n lastModified: string;\n storageClass?: string;\n isArchived: boolean;\n}\n\nexport interface SyncSessionContent {\n sessionId: string;\n content: string;\n compressed: boolean;\n}\n\nexport interface SharedFileEntry {\n filePath: string;\n fileName: string;\n size: number;\n contentType?: string;\n}\n\n/**\n * Encode each path segment but keep the `/` separators — `encodeURIComponent`\n * would escape the slashes too, breaking greedy proxy routes.\n */\nfunction encodeFilePath(filePath: string): string {\n return filePath.split(\"/\").map(encodeURIComponent).join(\"/\");\n}\n\nexport class AgentApiClient {\n private readonly apiKey: string;\n private readonly apiUrl: string;\n\n constructor(config: AgentApiClientConfig) {\n this.apiKey = config.apiKey;\n this.apiUrl = config.apiUrl;\n }\n\n private async request<T>(path: string, options?: RequestInit): Promise<T> {\n const url = `${this.apiUrl}${path}`;\n const headers = new Headers(options?.headers);\n headers.set(\"Authorization\", `Bearer ${this.apiKey}`);\n headers.set(\"Content-Type\", \"application/json\");\n\n const res = await fetch(url, { ...options, headers });\n\n if (!res.ok) {\n await res.text(); // drain body\n throw new Error(`Agent API request failed (${String(res.status)})`);\n }\n\n const body = (await res.json()) as { data: T };\n return body.data;\n }\n\n // ─── Sync ────────────────────────────────────────────────\n //\n // Workspace backup. The agent only ever calls /agents/sync/* — file\n // bytes go to/from S3 via presigned URLs (S3 fetch is the one\n // legitimate raw-fetch in a plugin). Dashboard editing uses the\n // user-API at /sync/agents/{agentId}/* and is not exposed here.\n\n async syncRegister(args?: { displayName?: string }): Promise<{ agent: SyncAgentInfo }> {\n return this.request(\"/agents/sync/register\", {\n method: \"POST\",\n body: JSON.stringify(args ?? {}),\n });\n }\n\n async syncGetManifest(): Promise<SyncManifest> {\n return this.request(\"/agents/sync/manifest\");\n }\n\n async syncPresign(args: {\n files: { path: string; operation: \"put\" | \"get\"; contentType?: string }[];\n }): Promise<{ urls: SyncPresignedUrl[] }> {\n return this.request(\"/agents/sync/presign\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async syncConfirmUpload(args: {\n filePath: string;\n hash: string;\n size: number;\n storageClass?: \"STANDARD\" | \"GLACIER_IR\";\n }): Promise<SyncConfirmedUpload> {\n return this.request(\"/agents/sync/confirm\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async syncReconstruct(args: {\n mode: \"full\" | \"active\" | \"memory\";\n }): Promise<SyncReconstructBundle> {\n return this.request(\"/agents/sync/reconstruct\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async syncGetStats(): Promise<SyncAgentStats> {\n return this.request(\"/agents/sync/stats\");\n }\n\n async syncListFiles(args?: { prefix?: string }): Promise<{ files: SyncFileEntry[] }> {\n const qs = new URLSearchParams();\n if (args?.prefix) qs.set(\"prefix\", args.prefix);\n const query = qs.toString();\n return this.request(`/agents/sync/files${query ? `?${query}` : \"\"}`);\n }\n\n async syncListSessions(): Promise<{ sessions: SyncSessionEntry[] }> {\n return this.request(\"/agents/sync/sessions\");\n }\n\n async syncGetSession(sessionId: string): Promise<SyncSessionContent> {\n return this.request(`/agents/sync/sessions/${encodeURIComponent(sessionId)}`);\n }\n\n async syncDeleteFile(filePath: string): Promise<{ removed: boolean }> {\n return this.request(`/agents/sync/files/${encodeFilePath(filePath)}`, {\n method: \"DELETE\",\n });\n }\n\n // ─── Shared (org/team/project) files ─────────────────────\n //\n // Used by the sync plugin's shared-sync engine to mirror org-scoped\n // files into the agent's `shared/` directory. Routes live in services/org.\n\n async sharedListFiles(args: {\n scope: \"org\" | \"team\" | \"project\";\n scopeId: string;\n }): Promise<{ files: SharedFileEntry[]; nextCursor: string | null }> {\n return this.request(\n `/agents/org/files/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}`,\n );\n }\n\n async sharedDownloadUrl(args: {\n scope: \"org\" | \"team\" | \"project\";\n scopeId: string;\n filePath: string;\n }): Promise<{ downloadUrl: string; expiresIn: number }> {\n return this.request(\n `/agents/org/files/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/download/${encodeFilePath(args.filePath)}`,\n );\n }\n\n async listIntegrations(): Promise<IntegrationInstall[]> {\n return this.request<IntegrationInstall[]>(\"/agent/integrations\");\n }\n\n async getIntegrationConfig(integrationId: string): Promise<IntegrationConfigResult> {\n return this.request<IntegrationConfigResult>(\n `/agent/integrations/${encodeURIComponent(integrationId)}/config`,\n );\n }\n\n async updateIntegrationConfig(\n integrationId: string,\n config: Record<string, unknown>,\n ): Promise<void> {\n await this.request<unknown>(\n `/agent/integrations/${encodeURIComponent(integrationId)}`,\n {\n method: \"PATCH\",\n body: JSON.stringify({ config }),\n },\n );\n }\n\n async installIntegration(\n integrationId: string,\n options?: { version?: string; config?: Record<string, unknown> },\n ): Promise<IntegrationInstall> {\n return this.request<IntegrationInstall>(\"/agent/integrations\", {\n method: \"POST\",\n body: JSON.stringify({\n integrationId,\n version: options?.version,\n config: options?.config,\n }),\n });\n }\n\n async removeIntegration(integrationId: string): Promise<IntegrationInstall> {\n return this.request<IntegrationInstall>(\n `/agent/integrations/${encodeURIComponent(integrationId)}`,\n { method: \"DELETE\" },\n );\n }\n\n async getOAuthUrl(\n provider: string,\n scopes?: string[],\n ): Promise<{ url: string; provider: string; expiresIn: number }> {\n const params = new URLSearchParams({ provider });\n if (scopes?.length) params.set(\"scopes\", scopes.join(\",\"));\n return this.request(`/agent/integrations/oauth/url?${params.toString()}`);\n }\n\n async getOAuthStatus(\n provider: string,\n ): Promise<{ provider: string; connected: boolean; config?: Record<string, string> }> {\n return this.request(\n `/agent/integrations/oauth/status?provider=${encodeURIComponent(provider)}`,\n );\n }\n\n async getRegistry(): Promise<{ integrations: RegistryEntry[] }> {\n return this.request<{ integrations: RegistryEntry[] }>(\"/integrations/registry\");\n }\n\n async getGoogleCredentials(): Promise<{\n accounts?: {\n email: string;\n refreshToken: string;\n clientId: string;\n clientSecret: string;\n enabledServices?: string[];\n isDefault: boolean;\n displayName?: string;\n }[];\n email: string;\n refreshToken: string;\n clientId: string;\n clientSecret: string;\n projectId: string;\n enabledServices?: string[];\n }> {\n return this.request(\"/agent/google/credentials\");\n }\n\n async disconnectGoogleAccount(email: string): Promise<{\n accounts: { email: string; displayName?: string; isDefault: boolean }[];\n }> {\n return this.request(`/agent/google/accounts/${encodeURIComponent(email)}`, {\n method: \"DELETE\",\n });\n }\n\n async setDefaultGoogleAccount(email: string): Promise<{\n accounts: { email: string; displayName?: string; isDefault: boolean }[];\n }> {\n return this.request(`/agent/google/accounts/${encodeURIComponent(email)}/default`, {\n method: \"PUT\",\n });\n }\n\n async getGoogleChatCredentials(): Promise<{\n email: string;\n refreshToken: string;\n clientId: string;\n clientSecret: string;\n displayName?: string;\n }> {\n return this.request(\"/agent/google-chat/credentials\");\n }\n\n async getGithubCredentials(): Promise<{\n login: string;\n accessToken: string;\n }> {\n return this.request(\"/agent/github/credentials\");\n }\n\n async getXeroCredentials(): Promise<{\n accessToken: string;\n accessTokenExpiresAt: string;\n xeroTenantId: string;\n }> {\n return this.request(\"/agent/xero/credentials\");\n }\n\n async refreshXeroToken(): Promise<{\n accessToken: string;\n expiresAt: string;\n }> {\n return this.request(\"/agent/xero/token\", { method: \"POST\" });\n }\n\n async getNotionCredentials(): Promise<{\n accessToken: string;\n workspaceId: string;\n workspaceName: string;\n }> {\n return this.request(\"/agent/notion/credentials\");\n }\n\n async getAtlassianCredentials(): Promise<{\n accessToken: string;\n refreshToken: string;\n accessTokenExpiresAt: string;\n cloudId: string;\n siteName: string;\n siteUrl: string;\n email: string;\n enabledProducts: string[];\n clientId: string;\n clientSecret: string;\n }> {\n return this.request(\"/agent/atlassian/credentials\");\n }\n\n async refreshAtlassianToken(): Promise<{\n accessToken: string;\n expiresAt: string;\n }> {\n return this.request(\"/agent/atlassian/token\", { method: \"POST\" });\n }\n\n async getMYOBCredentials(): Promise<{\n accessToken: string;\n accessTokenExpiresAt: string;\n myobBusinessId: string;\n clientId: string;\n }> {\n return this.request(\"/agent/myob/credentials\");\n }\n\n async refreshMYOBToken(): Promise<{\n accessToken: string;\n expiresAt: string;\n }> {\n return this.request(\"/agent/myob/token\", { method: \"POST\" });\n }\n\n async getTeamsCredentials(): Promise<{\n agentId: string;\n tenantId: string;\n azureAppId: string;\n azureBotId: string;\n azureClientSecret: string;\n botDisplayName?: string;\n teamsTenantId?: string;\n serviceUrl?: string;\n }> {\n return this.request(\"/agent/microsoft/credentials\");\n }\n\n async sendTeamsMessage(data: {\n conversationId: string;\n text?: string;\n adaptiveCard?: Record<string, unknown>;\n }): Promise<{ ok: boolean; activityId: string }> {\n return this.request(\"/agent/microsoft/send\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n }\n\n async listTeamsChannels(): Promise<{\n channels: { id: string; name: string; description?: string }[];\n }> {\n return this.request(\"/agent/microsoft/channels\");\n }\n\n async presignAttachments(files: { filename: string; mimeType: string; size: number }[]): Promise<{\n attachments: { id: string; uploadUrl: string; downloadUrl: string; s3Key: string; expiresAt: string }[];\n }> {\n return this.request(\"/agent/chat/attachments/presign\", {\n method: \"POST\",\n body: JSON.stringify({ files }),\n });\n }\n\n async recordActivity(data: {\n userId?: string;\n channel: string;\n role: \"user\" | \"assistant\";\n }): Promise<{ recorded: boolean }> {\n return this.request<{ recorded: boolean }>(\"/agent/activity\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n }\n\n // ─── Secrets ──────────────────────────────────────────────────\n //\n // Envelope CRUD + KMS proxy for per-scope encrypted secret storage.\n // Agents never hold a KMS master key — these proxy endpoints mint one-shot\n // AES-256 data keys bound (via KMS encryption context) to\n // `{ tenantId, scope, scopeId, secretId }`. The agent performs AES-256-GCM\n // locally; the backend only ever sees opaque envelopes.\n //\n // Routes resolve to the agent API gateway (mapping key `agent`), where\n // services/secrets registers its routes with pathPrefix `/secrets`. With\n // `apiUrl` set to the host root (e.g. `https://api.alfe.ai`), the full URL\n // is `https://api.alfe.ai/agent/secrets/...`. This is the same mapping as\n // `/agent/integrations/...` etc. — do NOT hit `/secrets/...` on the root\n // host: that's the user-auth dashboard gateway, which rejects agent tokens.\n //\n // `plaintextKey` in responses is base64 — callers MUST decode to a Node\n // `Buffer` immediately and zero it after use. NEVER keep plaintext keys\n // as JS strings (strings are immutable and cannot be wiped).\n\n /**\n * Mint a fresh AES-256 data key for a new secret or rotation. The encryption\n * context is rebuilt server-side from `auth.tenantId` + the body fields; the\n * agent cannot forge context for a scope it doesn't own.\n */\n async generateSecretDataKey(args: {\n scope: SecretScope;\n scopeId: string;\n secretId: string;\n }): Promise<GeneratedDataKey> {\n return this.request<GeneratedDataKey>(\"/agent/secrets/generate-data-key\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n /**\n * Unwrap a wrapped data key so the agent can decrypt the envelope locally.\n * KMS Decrypt will fail with `InvalidCiphertextException` if the envelope\n * was tampered with in a way that changes `{ tenantId, scope, scopeId, secretId }`.\n */\n async decryptSecretDataKey(args: {\n scope: SecretScope;\n scopeId: string;\n secretId: string;\n dataKeyCiphertext: string;\n }): Promise<{ plaintextKey: string }> {\n return this.request<{ plaintextKey: string }>(\"/agent/secrets/decrypt-data-key\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n /** Upload a pre-encrypted envelope for a secret. */\n async putSecretEnvelope(args: {\n scope: SecretScope;\n scopeId: string;\n secretId: string;\n secretName: string;\n envelope: EncryptedEnvelopeV1;\n description?: string;\n tags?: string[];\n }): Promise<{ secretId: string }> {\n const { scope, scopeId, secretId, ...body } = args;\n return this.request<{ secretId: string }>(\n `/agent/secrets/${encodeURIComponent(scope)}/${encodeURIComponent(scopeId)}/${encodeURIComponent(secretId)}`,\n {\n method: \"PUT\",\n body: JSON.stringify(body),\n },\n );\n }\n\n /** Fetch the encrypted envelope for a single secret. */\n async getSecretEnvelope(args: {\n scope: SecretScope;\n scopeId: string;\n secretId: string;\n }): Promise<SecretEnvelopeResponse> {\n return this.request<SecretEnvelopeResponse>(\n `/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/${encodeURIComponent(args.secretId)}`,\n );\n }\n\n /** List metadata (never envelopes) for secrets in a scope. */\n async listSecrets(args: {\n scope: SecretScope;\n scopeId: string;\n }): Promise<SecretMetadata[]> {\n const resp = await this.request<{ secrets: SecretMetadata[] }>(\n `/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}`,\n );\n return resp.secrets;\n }\n\n /** Delete a secret. */\n async deleteSecret(args: {\n scope: SecretScope;\n scopeId: string;\n secretId: string;\n }): Promise<void> {\n await this.request<unknown>(\n `/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/${encodeURIComponent(args.secretId)}`,\n { method: \"DELETE\" },\n );\n }\n\n /** Enumerate scopes (org/team/project/agent) this agent can access. */\n async listSecretScopes(): Promise<ScopeInfo[]> {\n const resp = await this.request<{ scopes: ScopeInfo[] }>(\"/agent/secrets/scopes\");\n return resp.scopes;\n }\n\n // ─── Identity ─────────────────────────────────────────────\n //\n // Identity resolution, permission enforcement, and CRM tools.\n // The agent API derives tenantId + agentId from the agent token.\n\n async resolveIdentity(args: {\n provider: string;\n platformId: string;\n kind?: \"user\" | \"agent\" | \"service\" | \"bot\" | \"workspace\";\n displayName?: string;\n }): Promise<{\n identityId: string | null;\n status: string;\n accessAllowed: boolean;\n created?: boolean;\n reason?: string;\n }> {\n return this.request(\"/agent/identity/resolve\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async searchIdentities(args?: {\n q?: string;\n status?: string;\n limit?: number;\n }): Promise<{ identities: unknown[] }> {\n const qs = new URLSearchParams();\n if (args?.q) qs.set(\"q\", args.q);\n if (args?.status) qs.set(\"status\", args.status);\n if (args?.limit) qs.set(\"limit\", String(args.limit));\n const query = qs.toString();\n return this.request(`/agent/identity/search${query ? `?${query}` : \"\"}`);\n }\n\n async getIdentityContext(identityId: string): Promise<{\n context: unknown;\n }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/context`);\n }\n\n async mergeIdentities(survivorId: string, args: {\n mergedId: string;\n changedBy: { type: string; id: string; name?: string };\n }): Promise<{ ok: boolean; error?: string }> {\n return this.request(`/agent/identity/${encodeURIComponent(survivorId)}/merge`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async unmergeIdentity(identityId: string, args: {\n changedBy: { type: string; id: string; name?: string };\n }): Promise<{ ok: boolean; error?: string }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/unmerge`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async addIdentityNote(identityId: string, args: {\n content: string;\n category?: string;\n changedBy: { type: string; id: string; name?: string };\n }): Promise<{ noteId: string | null }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/notes`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async tagIdentity(identityId: string, args: {\n tag: string;\n action: \"add\" | \"remove\";\n changedBy: { type: string; id: string; name?: string };\n }): Promise<{ ok: boolean }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/tags`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async getIdentityChangelog(identityId: string, args?: {\n limit?: number;\n }): Promise<{ entries: unknown[] }> {\n const qs = new URLSearchParams();\n if (args?.limit) qs.set(\"limit\", String(args.limit));\n const query = qs.toString();\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/changelog${query ? `?${query}` : \"\"}`);\n }\n\n async rollbackIdentity(identityId: string, args: {\n targetVersion: number;\n changedBy: { type: string; id: string; name?: string };\n }): Promise<{ ok: boolean; entry?: unknown }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/rollback`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async requestIdentityVerification(args: {\n claimedIdentityId: string;\n requestingIdentityId: string;\n requestingProvider: string;\n requestingPlatformId: string;\n preferredChannel?: \"mobile\" | \"email\";\n /**\n * Phase 2: agent-supplied contact endpoint. When provided, the top-level\n * `preferredChannel` is ignored — the contact's channel wins.\n */\n contact?: { channel: \"email\" | \"mobile\"; value: string };\n }): Promise<{\n verificationId: string;\n channel: string;\n deliveredTo: string;\n expiresAt: string;\n availableChannels: { channel: string; deliveredTo: string }[];\n } | { error: string }> {\n return this.request(\"/agent/identity/verify/request\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n async confirmIdentityVerification(args: {\n claimedIdentityId: string;\n verificationId: string;\n phrase: string;\n }): Promise<{\n verified: boolean;\n identityId?: string;\n /** Phase 2: how the confirm resolved — Scenario A vs B. */\n action?: \"merged\" | \"contact_verified\";\n error?: string;\n }> {\n return this.request(\"/agent/identity/verify/confirm\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n /**\n * Update display-shape fields on an Identity. Body excludes `email` /\n * `phone` / `title` / `company` / `metadata` per Section D4 — contacts go\n * via the verify flow, title/company live on OrgMembership, metadata is\n * not agent-writable.\n */\n async updateIdentity(\n identityId: string,\n args: {\n name?: string;\n avatarUrl?: string;\n timezone?: string;\n locale?: string;\n },\n ): Promise<{ ok: boolean }> {\n return this.request(`/agent/identity/${encodeURIComponent(identityId)}/update`, {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n /**\n * Phase 2 (Section H): server-side verification of a Google Chat sender via\n * the agent's existing Google OAuth credentials. Returns the resolved\n * identity (created or matched via Scenario-B email enrichment).\n */\n async resolveGoogleChatSender(args: {\n senderUserId: string;\n spaceId?: string;\n }): Promise<{\n identityId: string | null;\n status: string;\n accessAllowed: boolean;\n }> {\n return this.request(\"/agent/google/resolve-sender\", {\n method: \"POST\",\n body: JSON.stringify(args),\n });\n }\n\n // ─── Memory ──────────────────────────────────────────────\n //\n // Cloud memory (Turbopuffer vectors + DynamoDB knowledge graph).\n // The agent API derives tenantId + agentId from the agent token.\n\n async memorySearch(query: string, opts?: {\n limit?: number;\n topic?: string;\n subtopic?: string;\n tag?: string;\n includeKnowledge?: boolean;\n }): Promise<{\n facts: { subject: string; predicate: string; object: string; since: string; confidence: number }[];\n memories: { id: string; text: string; topic: string; subtopic: string; tag: string; importance: number; timestamp: number; score: number }[];\n }> {\n return this.request(\"/agent/memory/search\", {\n method: \"POST\",\n body: JSON.stringify({\n query,\n limit: opts?.limit ?? 10,\n topic: opts?.topic,\n subtopic: opts?.subtopic,\n tag: opts?.tag,\n includeKnowledge: opts?.includeKnowledge ?? true,\n }),\n });\n }\n\n async memoryStore(text: string, opts?: {\n topic?: string;\n subtopic?: string;\n tag?: string;\n importance?: number;\n }): Promise<{ memoryId: string }> {\n return this.request(\"/agent/memory/store\", {\n method: \"POST\",\n body: JSON.stringify({\n text,\n topic: opts?.topic ?? \"general\",\n subtopic: opts?.subtopic ?? \"general\",\n tag: opts?.tag ?? \"fact\",\n importance: opts?.importance ?? 0.7,\n }),\n });\n }\n\n async memoryIngest(sessionKey: string, messages: {\n role: string;\n content: string;\n index: number;\n timestamp?: string;\n }[], metadata?: {\n channelId?: string;\n userId?: string;\n userName?: string;\n }): Promise<{ queued: boolean; messageCount: number }> {\n return this.request(\"/agent/memory/ingest\", {\n method: \"POST\",\n body: JSON.stringify({\n sessionKey,\n lastProcessedIndex: messages.length > 0 ? messages[messages.length - 1].index : -1,\n messages,\n metadata,\n }),\n });\n }\n\n async memoryLoadContext(tier?: number, topicHint?: string): Promise<{\n formatted: string;\n [key: string]: unknown;\n }> {\n const params = new URLSearchParams();\n if (tier !== undefined) params.set(\"tier\", String(tier));\n if (topicHint) params.set(\"topicHint\", topicHint);\n const qs = params.toString();\n return this.request(`/agent/memory/context${qs ? `?${qs}` : \"\"}`);\n }\n\n async memoryLookupEntity(subject: string): Promise<{\n subject: string;\n triples: { tripleId: string; predicate: string; object: string; validFrom: string; validTo?: string; confidence: number }[];\n }> {\n return this.request(`/agent/memory/knowledge/entities?subject=${encodeURIComponent(subject)}`);\n }\n\n async memoryNavigate(): Promise<{\n topics: { name: string; tripleCount: number; subtopics: string[] }[];\n cursor: string | null;\n }> {\n return this.request(\"/agent/memory/navigate\");\n }\n\n async memoryDelete(memoryId: string): Promise<{ deleted: boolean }> {\n return this.request(`/agent/memory/${encodeURIComponent(memoryId)}`, {\n method: \"DELETE\",\n });\n }\n\n async memoryStats(): Promise<{\n vectorCount: number;\n tripleCount: number;\n storageEstimateBytes: number;\n lastIngestionAt?: string;\n }> {\n return this.request(\"/agent/memory/stats\");\n }\n\n // ─── Search ──────────────────────────────────────────────\n\n async searchWeb(params: {\n query: string;\n count?: number;\n offset?: number;\n country?: string;\n freshness?: string;\n }): Promise<unknown> {\n return this.request(\"/agent/search/web\", {\n method: \"POST\",\n body: JSON.stringify(params),\n });\n }\n\n async searchImages(params: {\n query: string;\n count?: number;\n }): Promise<unknown> {\n return this.request(\"/agent/search/images\", {\n method: \"POST\",\n body: JSON.stringify(params),\n });\n }\n\n async searchNews(params: {\n query: string;\n count?: number;\n freshness?: string;\n }): Promise<unknown> {\n return this.request(\"/agent/search/news\", {\n method: \"POST\",\n body: JSON.stringify(params),\n });\n }\n\n // ─── Database ───────────────────────────────────────────\n\n async registerDatabaseCredentials(): Promise<{\n connectionString: string;\n username: string;\n password: string;\n databases: string[];\n }> {\n return this.request(\"/agent/database/register\", { method: \"POST\" });\n }\n\n async reportDatabaseAudit(entry: {\n database: string;\n collection: string;\n operation: string;\n summary?: string;\n }): Promise<void> {\n await this.request(\"/agent/database/audit\", {\n method: \"POST\",\n body: JSON.stringify(entry),\n }).catch(() => {\n // Fire and forget — audit failure doesn't affect operations\n });\n }\n}\n"],"mappings":";;;;;AA4IA,SAAS,eAAe,UAA0B;AAChD,QAAO,SAAS,MAAM,IAAI,CAAC,IAAI,mBAAmB,CAAC,KAAK,IAAI;;AAG9D,IAAa,iBAAb,MAA4B;CAC1B;CACA;CAEA,YAAY,QAA8B;AACxC,OAAK,SAAS,OAAO;AACrB,OAAK,SAAS,OAAO;;CAGvB,MAAc,QAAW,MAAc,SAAmC;EACxE,MAAM,MAAM,GAAG,KAAK,SAAS;EAC7B,MAAM,UAAU,IAAI,QAAQ,SAAS,QAAQ;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oBAAoB,OAKR;AAChB,QAAM,KAAK,QAAQ,yBAAyB;GAC1C,QAAQ;GACR,MAAM,KAAK,UAAU,MAAM;GAC5B,CAAC,CAAC,YAAY,GAEb"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/agent-api-client",
3
- "version": "0.0.12",
3
+ "version": "0.1.0",
4
4
  "description": "Agent self-service API client — agents calling /agents/ endpoints",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",