@alfe.ai/agent-api-client 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +168 -11
- package/dist/index.d.cts +313 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +313 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +168 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17,25 +17,25 @@ var AgentApiClient = class {
|
|
|
17
17
|
headers
|
|
18
18
|
});
|
|
19
19
|
if (!res.ok) {
|
|
20
|
-
|
|
21
|
-
throw new Error(`Agent API
|
|
20
|
+
await res.text();
|
|
21
|
+
throw new Error(`Agent API request failed (${String(res.status)})`);
|
|
22
22
|
}
|
|
23
23
|
return (await res.json()).data;
|
|
24
24
|
}
|
|
25
25
|
async listIntegrations() {
|
|
26
|
-
return this.request("/
|
|
26
|
+
return this.request("/agent/integrations");
|
|
27
27
|
}
|
|
28
28
|
async getIntegrationConfig(integrationId) {
|
|
29
|
-
return this.request(`/
|
|
29
|
+
return this.request(`/agent/integrations/${encodeURIComponent(integrationId)}/config`);
|
|
30
30
|
}
|
|
31
31
|
async updateIntegrationConfig(integrationId, config) {
|
|
32
|
-
await this.request(`/
|
|
32
|
+
await this.request(`/agent/integrations/${encodeURIComponent(integrationId)}`, {
|
|
33
33
|
method: "PATCH",
|
|
34
34
|
body: JSON.stringify({ config })
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
async installIntegration(integrationId, options) {
|
|
38
|
-
return this.request("/
|
|
38
|
+
return this.request("/agent/integrations", {
|
|
39
39
|
method: "POST",
|
|
40
40
|
body: JSON.stringify({
|
|
41
41
|
integrationId,
|
|
@@ -45,26 +45,183 @@ var AgentApiClient = class {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
async removeIntegration(integrationId) {
|
|
48
|
-
return this.request(`/
|
|
48
|
+
return this.request(`/agent/integrations/${encodeURIComponent(integrationId)}`, { method: "DELETE" });
|
|
49
49
|
}
|
|
50
50
|
async getRegistry() {
|
|
51
51
|
return this.request("/integrations/registry");
|
|
52
52
|
}
|
|
53
53
|
async getGoogleCredentials() {
|
|
54
|
-
return this.request("/
|
|
54
|
+
return this.request("/agent/google/credentials");
|
|
55
|
+
}
|
|
56
|
+
async disconnectGoogleAccount(email) {
|
|
57
|
+
return this.request(`/agent/google/accounts/${encodeURIComponent(email)}`, { method: "DELETE" });
|
|
58
|
+
}
|
|
59
|
+
async setDefaultGoogleAccount(email) {
|
|
60
|
+
return this.request(`/agent/google/accounts/${encodeURIComponent(email)}/default`, { method: "PUT" });
|
|
61
|
+
}
|
|
62
|
+
async getGithubCredentials() {
|
|
63
|
+
return this.request("/agent/github/credentials");
|
|
55
64
|
}
|
|
56
65
|
async getXeroCredentials() {
|
|
57
|
-
return this.request("/
|
|
66
|
+
return this.request("/agent/xero/credentials");
|
|
58
67
|
}
|
|
59
68
|
async refreshXeroToken() {
|
|
60
|
-
return this.request("/
|
|
69
|
+
return this.request("/agent/xero/token", { method: "POST" });
|
|
70
|
+
}
|
|
71
|
+
async getNotionCredentials() {
|
|
72
|
+
return this.request("/agent/notion/credentials");
|
|
73
|
+
}
|
|
74
|
+
async getAtlassianCredentials() {
|
|
75
|
+
return this.request("/agent/atlassian/credentials");
|
|
76
|
+
}
|
|
77
|
+
async refreshAtlassianToken() {
|
|
78
|
+
return this.request("/agent/atlassian/token", { method: "POST" });
|
|
79
|
+
}
|
|
80
|
+
async getMYOBCredentials() {
|
|
81
|
+
return this.request("/agent/myob/credentials");
|
|
82
|
+
}
|
|
83
|
+
async refreshMYOBToken() {
|
|
84
|
+
return this.request("/agent/myob/token", { method: "POST" });
|
|
85
|
+
}
|
|
86
|
+
async getTeamsCredentials() {
|
|
87
|
+
return this.request("/agent/microsoft/credentials");
|
|
88
|
+
}
|
|
89
|
+
async sendTeamsMessage(data) {
|
|
90
|
+
return this.request("/agent/microsoft/send", {
|
|
91
|
+
method: "POST",
|
|
92
|
+
body: JSON.stringify(data)
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async listTeamsChannels() {
|
|
96
|
+
return this.request("/agent/microsoft/channels");
|
|
97
|
+
}
|
|
98
|
+
async presignAttachments(files) {
|
|
99
|
+
return this.request("/agent/chat/attachments/presign", {
|
|
100
|
+
method: "POST",
|
|
101
|
+
body: JSON.stringify({ files })
|
|
102
|
+
});
|
|
61
103
|
}
|
|
62
104
|
async recordActivity(data) {
|
|
63
|
-
return this.request("/
|
|
105
|
+
return this.request("/agent/activity", {
|
|
64
106
|
method: "POST",
|
|
65
107
|
body: JSON.stringify(data)
|
|
66
108
|
});
|
|
67
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Mint a fresh AES-256 data key for a new secret or rotation. The encryption
|
|
112
|
+
* context is rebuilt server-side from `auth.tenantId` + the body fields; the
|
|
113
|
+
* agent cannot forge context for a scope it doesn't own.
|
|
114
|
+
*/
|
|
115
|
+
async generateSecretDataKey(args) {
|
|
116
|
+
return this.request("/agent/secrets/generate-data-key", {
|
|
117
|
+
method: "POST",
|
|
118
|
+
body: JSON.stringify(args)
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Unwrap a wrapped data key so the agent can decrypt the envelope locally.
|
|
123
|
+
* KMS Decrypt will fail with `InvalidCiphertextException` if the envelope
|
|
124
|
+
* was tampered with in a way that changes `{ tenantId, scope, scopeId, secretId }`.
|
|
125
|
+
*/
|
|
126
|
+
async decryptSecretDataKey(args) {
|
|
127
|
+
return this.request("/agent/secrets/decrypt-data-key", {
|
|
128
|
+
method: "POST",
|
|
129
|
+
body: JSON.stringify(args)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/** Upload a pre-encrypted envelope for a secret. */
|
|
133
|
+
async putSecretEnvelope(args) {
|
|
134
|
+
const { scope, scopeId, secretId, ...body } = args;
|
|
135
|
+
return this.request(`/agent/secrets/${encodeURIComponent(scope)}/${encodeURIComponent(scopeId)}/${encodeURIComponent(secretId)}`, {
|
|
136
|
+
method: "PUT",
|
|
137
|
+
body: JSON.stringify(body)
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/** Fetch the encrypted envelope for a single secret. */
|
|
141
|
+
async getSecretEnvelope(args) {
|
|
142
|
+
return this.request(`/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/${encodeURIComponent(args.secretId)}`);
|
|
143
|
+
}
|
|
144
|
+
/** List metadata (never envelopes) for secrets in a scope. */
|
|
145
|
+
async listSecrets(args) {
|
|
146
|
+
return (await this.request(`/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}`)).secrets;
|
|
147
|
+
}
|
|
148
|
+
/** Delete a secret. */
|
|
149
|
+
async deleteSecret(args) {
|
|
150
|
+
await this.request(`/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/${encodeURIComponent(args.secretId)}`, { method: "DELETE" });
|
|
151
|
+
}
|
|
152
|
+
/** Enumerate scopes (org/team/project/agent) this agent can access. */
|
|
153
|
+
async listSecretScopes() {
|
|
154
|
+
return (await this.request("/agent/secrets/scopes")).scopes;
|
|
155
|
+
}
|
|
156
|
+
async resolveIdentity(args) {
|
|
157
|
+
return this.request("/agent/identity/resolve", {
|
|
158
|
+
method: "POST",
|
|
159
|
+
body: JSON.stringify(args)
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
async enforcePolicy(args) {
|
|
163
|
+
return this.request("/agent/identity/enforce", {
|
|
164
|
+
method: "POST",
|
|
165
|
+
body: JSON.stringify(args)
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
async checkToolPermission(args) {
|
|
169
|
+
return this.request("/agent/identity/check-tool", {
|
|
170
|
+
method: "POST",
|
|
171
|
+
body: JSON.stringify(args)
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
async searchIdentities(args) {
|
|
175
|
+
const qs = new URLSearchParams();
|
|
176
|
+
if (args?.q) qs.set("q", args.q);
|
|
177
|
+
if (args?.status) qs.set("status", args.status);
|
|
178
|
+
if (args?.tag) qs.set("tag", args.tag);
|
|
179
|
+
if (args?.platform) qs.set("platform", args.platform);
|
|
180
|
+
if (args?.limit) qs.set("limit", String(args.limit));
|
|
181
|
+
if (args?.offset) qs.set("offset", String(args.offset));
|
|
182
|
+
const query = qs.toString();
|
|
183
|
+
return this.request(`/agent/identity/search${query ? `?${query}` : ""}`);
|
|
184
|
+
}
|
|
185
|
+
async getIdentityContext(identityId) {
|
|
186
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/context`);
|
|
187
|
+
}
|
|
188
|
+
async mergeIdentities(survivorId, args) {
|
|
189
|
+
return this.request(`/agent/identity/${encodeURIComponent(survivorId)}/merge`, {
|
|
190
|
+
method: "POST",
|
|
191
|
+
body: JSON.stringify(args)
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
async unmergeIdentity(identityId, args) {
|
|
195
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/unmerge`, {
|
|
196
|
+
method: "POST",
|
|
197
|
+
body: JSON.stringify(args)
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
async addIdentityNote(identityId, args) {
|
|
201
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/notes`, {
|
|
202
|
+
method: "POST",
|
|
203
|
+
body: JSON.stringify(args)
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
async tagIdentity(identityId, args) {
|
|
207
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/tags`, {
|
|
208
|
+
method: "POST",
|
|
209
|
+
body: JSON.stringify(args)
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
async getIdentityChangelog(identityId, args) {
|
|
213
|
+
const qs = new URLSearchParams();
|
|
214
|
+
if (args?.limit) qs.set("limit", String(args.limit));
|
|
215
|
+
if (args?.offset) qs.set("offset", String(args.offset));
|
|
216
|
+
const query = qs.toString();
|
|
217
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/changelog${query ? `?${query}` : ""}`);
|
|
218
|
+
}
|
|
219
|
+
async rollbackIdentity(identityId, args) {
|
|
220
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/rollback`, {
|
|
221
|
+
method: "POST",
|
|
222
|
+
body: JSON.stringify(args)
|
|
223
|
+
});
|
|
224
|
+
}
|
|
68
225
|
};
|
|
69
226
|
//#endregion
|
|
70
227
|
exports.AgentApiClient = AgentApiClient;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
//#region ../../packages-internal/types/dist/integration.d.ts
|
|
2
2
|
|
|
3
|
-
/** Controls where an integration appears: public (everyone),
|
|
3
|
+
/** Controls where an integration appears: public (everyone), hidden (nowhere) */
|
|
4
4
|
declare const IntegrationVisibility: {
|
|
5
5
|
readonly Public: "public";
|
|
6
|
-
readonly Dev: "dev";
|
|
7
6
|
readonly Hidden: "hidden";
|
|
8
7
|
};
|
|
9
8
|
type IntegrationVisibility = (typeof IntegrationVisibility)[keyof typeof IntegrationVisibility];
|
|
@@ -58,6 +57,7 @@ interface IntegrationConfigSchemaField {
|
|
|
58
57
|
}[];
|
|
59
58
|
oauth_provider?: string;
|
|
60
59
|
editable?: string;
|
|
60
|
+
hidden?: boolean;
|
|
61
61
|
}
|
|
62
62
|
interface IntegrationConfigResult {
|
|
63
63
|
integrationId: string;
|
|
@@ -95,6 +95,61 @@ interface RegistryEntry {
|
|
|
95
95
|
}
|
|
96
96
|
//# sourceMappingURL=integration.d.ts.map
|
|
97
97
|
//#endregion
|
|
98
|
+
//#region ../../packages-internal/types/dist/secrets.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* Secrets types — shared between services/secrets, @alfe.ai/agent-api-client,
|
|
101
|
+
* the openclaw-secrets plugin, and dashboard clients.
|
|
102
|
+
*
|
|
103
|
+
* Server-side crypto and KMS glue live in @alfe/secret-store (Node/AWS-only);
|
|
104
|
+
* this module is a pure, dependency-free shape contract safe for every
|
|
105
|
+
* environment the agent-api-client ships to.
|
|
106
|
+
*/
|
|
107
|
+
/** Scope levels at which a secret can be owned. */
|
|
108
|
+
type SecretScope = "org" | "team" | "project" | "agent";
|
|
109
|
+
/**
|
|
110
|
+
* v1 encrypted envelope as persisted by services/secrets and exchanged with
|
|
111
|
+
* agents. Values are AES-256-GCM ciphertext; iv/authTag/ciphertext/dataKeyCiphertext
|
|
112
|
+
* are all base64-encoded.
|
|
113
|
+
*/
|
|
114
|
+
interface EncryptedEnvelopeV1 {
|
|
115
|
+
version: 1;
|
|
116
|
+
iv: string;
|
|
117
|
+
ciphertext: string;
|
|
118
|
+
authTag: string;
|
|
119
|
+
dataKeyCiphertext: string;
|
|
120
|
+
}
|
|
121
|
+
/** Opaque metadata about a secret row — never includes plaintext. */
|
|
122
|
+
interface SecretMetadata {
|
|
123
|
+
secretId: string;
|
|
124
|
+
secretName: string;
|
|
125
|
+
description?: string;
|
|
126
|
+
tags?: string[];
|
|
127
|
+
createdAt: string;
|
|
128
|
+
updatedAt: string;
|
|
129
|
+
rotatedAt?: string;
|
|
130
|
+
}
|
|
131
|
+
/** A single secret row including its encrypted envelope. */
|
|
132
|
+
interface SecretEnvelopeResponse extends SecretMetadata {
|
|
133
|
+
envelope: EncryptedEnvelopeV1;
|
|
134
|
+
}
|
|
135
|
+
/** A scope the caller can read or write secrets in. */
|
|
136
|
+
interface ScopeInfo {
|
|
137
|
+
scope: SecretScope;
|
|
138
|
+
scopeId: string;
|
|
139
|
+
name?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* KMS-issued data key, returned by the secrets service's
|
|
143
|
+
* `/secrets/generate-data-key` KMS proxy endpoint. The plaintext key is
|
|
144
|
+
* returned base64-encoded; callers MUST decode it to a Buffer and zero the
|
|
145
|
+
* Buffer after use — never keep the plaintext as a JS string.
|
|
146
|
+
*/
|
|
147
|
+
interface GeneratedDataKey {
|
|
148
|
+
plaintextKey: string;
|
|
149
|
+
dataKeyCiphertext: string;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=secrets.d.ts.map
|
|
152
|
+
//#endregion
|
|
98
153
|
//#region src/index.d.ts
|
|
99
154
|
interface AgentApiClientConfig {
|
|
100
155
|
apiKey: string;
|
|
@@ -117,6 +172,15 @@ declare class AgentApiClient {
|
|
|
117
172
|
integrations: RegistryEntry[];
|
|
118
173
|
}>;
|
|
119
174
|
getGoogleCredentials(): Promise<{
|
|
175
|
+
accounts?: {
|
|
176
|
+
email: string;
|
|
177
|
+
refreshToken: string;
|
|
178
|
+
clientId: string;
|
|
179
|
+
clientSecret: string;
|
|
180
|
+
enabledServices?: string[];
|
|
181
|
+
isDefault: boolean;
|
|
182
|
+
displayName?: string;
|
|
183
|
+
}[];
|
|
120
184
|
email: string;
|
|
121
185
|
refreshToken: string;
|
|
122
186
|
clientId: string;
|
|
@@ -124,6 +188,24 @@ declare class AgentApiClient {
|
|
|
124
188
|
projectId: string;
|
|
125
189
|
enabledServices?: string[];
|
|
126
190
|
}>;
|
|
191
|
+
disconnectGoogleAccount(email: string): Promise<{
|
|
192
|
+
accounts: {
|
|
193
|
+
email: string;
|
|
194
|
+
displayName?: string;
|
|
195
|
+
isDefault: boolean;
|
|
196
|
+
}[];
|
|
197
|
+
}>;
|
|
198
|
+
setDefaultGoogleAccount(email: string): Promise<{
|
|
199
|
+
accounts: {
|
|
200
|
+
email: string;
|
|
201
|
+
displayName?: string;
|
|
202
|
+
isDefault: boolean;
|
|
203
|
+
}[];
|
|
204
|
+
}>;
|
|
205
|
+
getGithubCredentials(): Promise<{
|
|
206
|
+
login: string;
|
|
207
|
+
accessToken: string;
|
|
208
|
+
}>;
|
|
127
209
|
getXeroCredentials(): Promise<{
|
|
128
210
|
accessToken: string;
|
|
129
211
|
accessTokenExpiresAt: string;
|
|
@@ -133,6 +215,73 @@ declare class AgentApiClient {
|
|
|
133
215
|
accessToken: string;
|
|
134
216
|
expiresAt: string;
|
|
135
217
|
}>;
|
|
218
|
+
getNotionCredentials(): Promise<{
|
|
219
|
+
accessToken: string;
|
|
220
|
+
workspaceId: string;
|
|
221
|
+
workspaceName: string;
|
|
222
|
+
}>;
|
|
223
|
+
getAtlassianCredentials(): Promise<{
|
|
224
|
+
accessToken: string;
|
|
225
|
+
refreshToken: string;
|
|
226
|
+
accessTokenExpiresAt: string;
|
|
227
|
+
cloudId: string;
|
|
228
|
+
siteName: string;
|
|
229
|
+
siteUrl: string;
|
|
230
|
+
email: string;
|
|
231
|
+
enabledProducts: string[];
|
|
232
|
+
}>;
|
|
233
|
+
refreshAtlassianToken(): Promise<{
|
|
234
|
+
accessToken: string;
|
|
235
|
+
expiresAt: string;
|
|
236
|
+
}>;
|
|
237
|
+
getMYOBCredentials(): Promise<{
|
|
238
|
+
accessToken: string;
|
|
239
|
+
accessTokenExpiresAt: string;
|
|
240
|
+
myobBusinessId: string;
|
|
241
|
+
clientId: string;
|
|
242
|
+
}>;
|
|
243
|
+
refreshMYOBToken(): Promise<{
|
|
244
|
+
accessToken: string;
|
|
245
|
+
expiresAt: string;
|
|
246
|
+
}>;
|
|
247
|
+
getTeamsCredentials(): Promise<{
|
|
248
|
+
agentId: string;
|
|
249
|
+
tenantId: string;
|
|
250
|
+
azureAppId: string;
|
|
251
|
+
azureBotId: string;
|
|
252
|
+
azureClientSecret: string;
|
|
253
|
+
botDisplayName?: string;
|
|
254
|
+
teamsTenantId?: string;
|
|
255
|
+
serviceUrl?: string;
|
|
256
|
+
}>;
|
|
257
|
+
sendTeamsMessage(data: {
|
|
258
|
+
conversationId: string;
|
|
259
|
+
text?: string;
|
|
260
|
+
adaptiveCard?: Record<string, unknown>;
|
|
261
|
+
}): Promise<{
|
|
262
|
+
ok: boolean;
|
|
263
|
+
activityId: string;
|
|
264
|
+
}>;
|
|
265
|
+
listTeamsChannels(): Promise<{
|
|
266
|
+
channels: {
|
|
267
|
+
id: string;
|
|
268
|
+
name: string;
|
|
269
|
+
description?: string;
|
|
270
|
+
}[];
|
|
271
|
+
}>;
|
|
272
|
+
presignAttachments(files: {
|
|
273
|
+
filename: string;
|
|
274
|
+
mimeType: string;
|
|
275
|
+
size: number;
|
|
276
|
+
}[]): Promise<{
|
|
277
|
+
attachments: {
|
|
278
|
+
id: string;
|
|
279
|
+
uploadUrl: string;
|
|
280
|
+
downloadUrl: string;
|
|
281
|
+
s3Key: string;
|
|
282
|
+
expiresAt: string;
|
|
283
|
+
}[];
|
|
284
|
+
}>;
|
|
136
285
|
recordActivity(data: {
|
|
137
286
|
userId?: string;
|
|
138
287
|
channel: string;
|
|
@@ -140,9 +289,169 @@ declare class AgentApiClient {
|
|
|
140
289
|
}): Promise<{
|
|
141
290
|
recorded: boolean;
|
|
142
291
|
}>;
|
|
292
|
+
/**
|
|
293
|
+
* Mint a fresh AES-256 data key for a new secret or rotation. The encryption
|
|
294
|
+
* context is rebuilt server-side from `auth.tenantId` + the body fields; the
|
|
295
|
+
* agent cannot forge context for a scope it doesn't own.
|
|
296
|
+
*/
|
|
297
|
+
generateSecretDataKey(args: {
|
|
298
|
+
scope: SecretScope;
|
|
299
|
+
scopeId: string;
|
|
300
|
+
secretId: string;
|
|
301
|
+
}): Promise<GeneratedDataKey>;
|
|
302
|
+
/**
|
|
303
|
+
* Unwrap a wrapped data key so the agent can decrypt the envelope locally.
|
|
304
|
+
* KMS Decrypt will fail with `InvalidCiphertextException` if the envelope
|
|
305
|
+
* was tampered with in a way that changes `{ tenantId, scope, scopeId, secretId }`.
|
|
306
|
+
*/
|
|
307
|
+
decryptSecretDataKey(args: {
|
|
308
|
+
scope: SecretScope;
|
|
309
|
+
scopeId: string;
|
|
310
|
+
secretId: string;
|
|
311
|
+
dataKeyCiphertext: string;
|
|
312
|
+
}): Promise<{
|
|
313
|
+
plaintextKey: string;
|
|
314
|
+
}>;
|
|
315
|
+
/** Upload a pre-encrypted envelope for a secret. */
|
|
316
|
+
putSecretEnvelope(args: {
|
|
317
|
+
scope: SecretScope;
|
|
318
|
+
scopeId: string;
|
|
319
|
+
secretId: string;
|
|
320
|
+
secretName: string;
|
|
321
|
+
envelope: EncryptedEnvelopeV1;
|
|
322
|
+
description?: string;
|
|
323
|
+
tags?: string[];
|
|
324
|
+
}): Promise<{
|
|
325
|
+
secretId: string;
|
|
326
|
+
}>;
|
|
327
|
+
/** Fetch the encrypted envelope for a single secret. */
|
|
328
|
+
getSecretEnvelope(args: {
|
|
329
|
+
scope: SecretScope;
|
|
330
|
+
scopeId: string;
|
|
331
|
+
secretId: string;
|
|
332
|
+
}): Promise<SecretEnvelopeResponse>;
|
|
333
|
+
/** List metadata (never envelopes) for secrets in a scope. */
|
|
334
|
+
listSecrets(args: {
|
|
335
|
+
scope: SecretScope;
|
|
336
|
+
scopeId: string;
|
|
337
|
+
}): Promise<SecretMetadata[]>;
|
|
338
|
+
/** Delete a secret. */
|
|
339
|
+
deleteSecret(args: {
|
|
340
|
+
scope: SecretScope;
|
|
341
|
+
scopeId: string;
|
|
342
|
+
secretId: string;
|
|
343
|
+
}): Promise<void>;
|
|
344
|
+
/** Enumerate scopes (org/team/project/agent) this agent can access. */
|
|
345
|
+
listSecretScopes(): Promise<ScopeInfo[]>;
|
|
346
|
+
resolveIdentity(args: {
|
|
347
|
+
platform: string;
|
|
348
|
+
platformId: string;
|
|
349
|
+
displayName?: string;
|
|
350
|
+
}): Promise<{
|
|
351
|
+
identityId: string | null;
|
|
352
|
+
status: string;
|
|
353
|
+
accessAllowed: boolean;
|
|
354
|
+
created?: boolean;
|
|
355
|
+
reason?: string;
|
|
356
|
+
}>;
|
|
357
|
+
enforcePolicy(args: {
|
|
358
|
+
platform: string;
|
|
359
|
+
senderId: string;
|
|
360
|
+
channelId?: string;
|
|
361
|
+
}): Promise<{
|
|
362
|
+
identityId: string | null;
|
|
363
|
+
orgId: string | null;
|
|
364
|
+
role: string | null;
|
|
365
|
+
allowedTools: string[];
|
|
366
|
+
deniedTools: string[];
|
|
367
|
+
identified: boolean;
|
|
368
|
+
}>;
|
|
369
|
+
checkToolPermission(args: {
|
|
370
|
+
platform: string;
|
|
371
|
+
senderId: string;
|
|
372
|
+
toolName: string;
|
|
373
|
+
toolArgs?: Record<string, unknown>;
|
|
374
|
+
channelId?: string;
|
|
375
|
+
}): Promise<{
|
|
376
|
+
allowed: boolean;
|
|
377
|
+
reason?: string;
|
|
378
|
+
}>;
|
|
379
|
+
searchIdentities(args?: {
|
|
380
|
+
q?: string;
|
|
381
|
+
status?: string;
|
|
382
|
+
tag?: string;
|
|
383
|
+
platform?: string;
|
|
384
|
+
limit?: number;
|
|
385
|
+
offset?: number;
|
|
386
|
+
}): Promise<{
|
|
387
|
+
identities: unknown[];
|
|
388
|
+
}>;
|
|
389
|
+
getIdentityContext(identityId: string): Promise<{
|
|
390
|
+
identity: unknown;
|
|
391
|
+
recentChanges: unknown[];
|
|
392
|
+
}>;
|
|
393
|
+
mergeIdentities(survivorId: string, args: {
|
|
394
|
+
mergedId: string;
|
|
395
|
+
changedBy: {
|
|
396
|
+
type: string;
|
|
397
|
+
id: string;
|
|
398
|
+
name?: string;
|
|
399
|
+
};
|
|
400
|
+
}): Promise<{
|
|
401
|
+
ok: boolean;
|
|
402
|
+
error?: string;
|
|
403
|
+
}>;
|
|
404
|
+
unmergeIdentity(identityId: string, args: {
|
|
405
|
+
changedBy: {
|
|
406
|
+
type: string;
|
|
407
|
+
id: string;
|
|
408
|
+
name?: string;
|
|
409
|
+
};
|
|
410
|
+
}): Promise<{
|
|
411
|
+
ok: boolean;
|
|
412
|
+
error?: string;
|
|
413
|
+
}>;
|
|
414
|
+
addIdentityNote(identityId: string, args: {
|
|
415
|
+
content: string;
|
|
416
|
+
category?: string;
|
|
417
|
+
changedBy: {
|
|
418
|
+
type: string;
|
|
419
|
+
id: string;
|
|
420
|
+
name?: string;
|
|
421
|
+
};
|
|
422
|
+
}): Promise<{
|
|
423
|
+
noteId: string | null;
|
|
424
|
+
}>;
|
|
425
|
+
tagIdentity(identityId: string, args: {
|
|
426
|
+
tag: string;
|
|
427
|
+
action: "add" | "remove";
|
|
428
|
+
changedBy: {
|
|
429
|
+
type: string;
|
|
430
|
+
id: string;
|
|
431
|
+
name?: string;
|
|
432
|
+
};
|
|
433
|
+
}): Promise<{
|
|
434
|
+
ok: boolean;
|
|
435
|
+
}>;
|
|
436
|
+
getIdentityChangelog(identityId: string, args?: {
|
|
437
|
+
limit?: number;
|
|
438
|
+
offset?: number;
|
|
439
|
+
}): Promise<{
|
|
440
|
+
entries: unknown[];
|
|
441
|
+
}>;
|
|
442
|
+
rollbackIdentity(identityId: string, args: {
|
|
443
|
+
targetVersion: number;
|
|
444
|
+
changedBy: {
|
|
445
|
+
type: string;
|
|
446
|
+
id: string;
|
|
447
|
+
name?: string;
|
|
448
|
+
};
|
|
449
|
+
}): Promise<{
|
|
450
|
+
ok: boolean;
|
|
451
|
+
entry?: unknown;
|
|
452
|
+
}>;
|
|
143
453
|
}
|
|
144
454
|
//# sourceMappingURL=index.d.ts.map
|
|
145
|
-
|
|
146
455
|
//#endregion
|
|
147
|
-
export { AgentApiClient, AgentApiClientConfig, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, type RegistryEntry };
|
|
456
|
+
export { AgentApiClient, AgentApiClientConfig, type EncryptedEnvelopeV1, type GeneratedDataKey, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, type RegistryEntry, type ScopeInfo, type SecretEnvelopeResponse, type SecretMetadata, type SecretScope };
|
|
148
457
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":["DEFAULT_INTEGRATIONS","IntegrationVisibility","INTEGRATION_VISIBILITIES","IntegrationScope","INTEGRATION_SCOPES","IntegrationDesiredStatus","INTEGRATION_DESIRED_STATUSES","IntegrationActualStatus","INTEGRATION_ACTUAL_STATUSES","IntegrationInstall","Record","AgentIntegration","OrgIntegration","IntegrationConfigSchemaField","IntegrationConfigResult","RegistryEntry"],"sources":["../../../packages-internal/types/dist/integration.d.ts","../src/index.ts"],"sourcesContent":["/** 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), dev (non-prod only), hidden (nowhere) */\nexport declare const IntegrationVisibility: {\n readonly Public: \"public\";\n readonly Dev: \"dev\";\n readonly Hidden: \"hidden\";\n};\nexport type IntegrationVisibility = (typeof IntegrationVisibility)[keyof typeof IntegrationVisibility];\nexport declare const INTEGRATION_VISIBILITIES: readonly [\"dev\" | \"public\" | \"hidden\", ...(\"dev\" | \"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 = (typeof IntegrationScope)[keyof typeof IntegrationScope];\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 editable?: string;\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"],"mappings":";;AAQA;AAAiC,cALZC,qBAKY,EAAA;WAAWA,MAAAA,EAAAA,QAAAA;WAAoCA,GAAAA,EAAAA,KAAAA;EAAqB,SAAA,MAAA,EAAA,QAAA;AAGrG,CAAA;AAMYE,KATAF,qBAAAA,GASgB,CAAA,OATgBA,qBAShB,CAAA,CAAA,MAAA,OAToDA,qBASpD,CAAA;;AAA0CE,cANjDA,gBAMiDA,EAAAA;EAAgB,SAAA,GAAA,EAAA,KAAA;EAEjEE,SAAAA,IAAAA,EAAAA,MA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EAAA,MAAA;IASDG,QAAAA,EAAAA,MAAAA;IAeAC,YAAAA,EAAAA,MAAAA;IAAuB,SAAA,EAAA,MAAA;IAE5BJ,eAAAA,CAAAA,EAAAA,MAAAA,EAAAA;;EACkC,kBAAA,CAAA,CAAA,ECqChB,ODrCgB,CAAA;IAE7BK,WAAAA,EAAa,MAAA;IAAA,oBAAA,EAAA,MAAA;IAsBVF,YAAAA,EAAAA,MAAAA;;kBAKHZ,CAAAA,CAAAA,ECgBW,ODhBXA,CAAAA;IAAqB,WAAA,EAAA,MAAA;;;;IClFrB,MAAA,CAAA,EAAA,MAAA;IAKJ,OAAA,EAAA,MAAc;IAAA,IAAA,EAAA,MAAA,GAAA,WAAA;MAwGrB,OApGgB,CAAA;IAsBc,QAAA,EAAA,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["DEFAULT_INTEGRATIONS","IntegrationVisibility","INTEGRATION_VISIBILITIES","IntegrationScope","INTEGRATION_SCOPES","IntegrationDesiredStatus","INTEGRATION_DESIRED_STATUSES","IntegrationActualStatus","INTEGRATION_ACTUAL_STATUSES","IntegrationInstall","Record","AgentIntegration","OrgIntegration","IntegrationConfigSchemaField","IntegrationConfigResult","RegistryEntry","SecretScope","EncryptedEnvelopeV1","SecretMetadata","SecretEnvelopeResponse","ScopeInfo","GeneratedDataKey"],"sources":["../../../packages-internal/types/dist/integration.d.ts","../../../packages-internal/types/dist/secrets.d.ts","../src/index.ts"],"sourcesContent":["/** 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 = (typeof IntegrationScope)[keyof typeof IntegrationScope];\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 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 */\n/** Scope levels at which a secret can be owned. */\nexport type SecretScope = \"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":";;AAOA;AAAiC,cAJZC,qBAIY,EAAA;WAAWA,MAAAA,EAAAA,QAAAA;WAAoCA,MAAAA,EAAAA,QAAAA;CAAqB;AAGhFE,KAHTF,qBAAAA,GAQX,CAAA,OAR2CA,qBAQ3C,CAAA,CAAA,MAAA,OAR+EA,qBAQ/E,CAAA;;AACsCE,cANlBA,gBAMkBA,EAAAA;WAA+BA,GAAAA,EAAAA,KAAAA;EAAgB,SAAA,IAAA,EAAA,MAAA;EAEjEE,SAAAA,OAAAA,EAAAA,SAGpB;EACWA,SAAAA,KAAAA,EAAAA,OAAAA;CAAwB;AAAWA,KANnCF,gBAAAA,GAMmCE,CAAAA,OANRF,gBAMQE,CAAAA,CAAAA,MAAAA,OANuBF,gBAMvBE,CAAAA;AAA+D,cAJzFA,wBAIyF,EAAA;EAEzFE,SAAAA,MAAAA,EAAAA,QAAAA;EAQTA,SAAAA,OAAAA,EAAAA,SAAuB;CAAA;AAAWA,KAVlCF,wBAAAA,GAUkCE,CAAAA,OAVCF,wBAUDE,CAAAA,CAAAA,MAAAA,OAVwCF,wBAUxCE,CAAAA;AAA6D,cARtFA,uBAQsF,EAAA;EAE1FE,SAAAA,UAAAA,EAAkB,YAAA;EAAA,SAAA,MAAA,EAAA,QAAA;WACxBN,KAAAA,EAAAA,OAAAA;WAIQE,QAAAA,EAAAA,UAAAA;WACDE,QAAAA,EAAAA,UAAAA;WAENG,OAAAA,EAAAA,SAAAA;CAAM;AASDG,KAnBLN,uBAAAA,GAmBiC,CAAA,OAnBCA,uBAmBD,CAAA,CAAA,MAAA,OAnBuCA,uBAmBvC,CAAA;AAgBL,UAjCvBE,kBAAAA,CAiCuB;OAE5BC,EAlCDP,gBAkCCO;SACMG,EAAAA,MAAAA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A,MAAA;IAEG,UAAA,EAAA,MAAA;IAAR,iBAAA,EAAA,MAAA;IASK,cAAA,CAAA,EAAA,MAAA;IAGL,aAAA,CAAA,EAAA,MAAA;IAQ8B,UAAA,CAAA,EAAA,MAAA;;kBAc9B,CAAA,IAAA,EAAA;IAiBA,cAAA,EAAA,MAAA;IAkBS,IAAA,CAAA,EAAA,MAAA;IAET,YAAA,CAAA,EAhMa,MAgMb,CAAA,MAAA,EAAA,OAAA,CAAA;MA/LA,OA6MA,CAAA;IAY0C,EAAA,EAAA,OAAA;IAU1C,UAAA,EAAA,MAAA;;mBAoBA,CAAA,CAAA,EAhPuB,OAgPvB,CAAA;IAWA,QAAA,EAAA;MAUA,EAAA,EAAA,MAAA;MAWA,IAAA,EAAA,MAAA;MAAO,WAAA,CAAA,EAAA,MAAA;;;;;;;QA1Q8E;;;;;;;;;;;;;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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
//#region ../../packages-internal/types/dist/integration.d.ts
|
|
2
2
|
|
|
3
|
-
/** Controls where an integration appears: public (everyone),
|
|
3
|
+
/** Controls where an integration appears: public (everyone), hidden (nowhere) */
|
|
4
4
|
declare const IntegrationVisibility: {
|
|
5
5
|
readonly Public: "public";
|
|
6
|
-
readonly Dev: "dev";
|
|
7
6
|
readonly Hidden: "hidden";
|
|
8
7
|
};
|
|
9
8
|
type IntegrationVisibility = (typeof IntegrationVisibility)[keyof typeof IntegrationVisibility];
|
|
@@ -58,6 +57,7 @@ interface IntegrationConfigSchemaField {
|
|
|
58
57
|
}[];
|
|
59
58
|
oauth_provider?: string;
|
|
60
59
|
editable?: string;
|
|
60
|
+
hidden?: boolean;
|
|
61
61
|
}
|
|
62
62
|
interface IntegrationConfigResult {
|
|
63
63
|
integrationId: string;
|
|
@@ -95,6 +95,61 @@ interface RegistryEntry {
|
|
|
95
95
|
}
|
|
96
96
|
//# sourceMappingURL=integration.d.ts.map
|
|
97
97
|
//#endregion
|
|
98
|
+
//#region ../../packages-internal/types/dist/secrets.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* Secrets types — shared between services/secrets, @alfe.ai/agent-api-client,
|
|
101
|
+
* the openclaw-secrets plugin, and dashboard clients.
|
|
102
|
+
*
|
|
103
|
+
* Server-side crypto and KMS glue live in @alfe/secret-store (Node/AWS-only);
|
|
104
|
+
* this module is a pure, dependency-free shape contract safe for every
|
|
105
|
+
* environment the agent-api-client ships to.
|
|
106
|
+
*/
|
|
107
|
+
/** Scope levels at which a secret can be owned. */
|
|
108
|
+
type SecretScope = "org" | "team" | "project" | "agent";
|
|
109
|
+
/**
|
|
110
|
+
* v1 encrypted envelope as persisted by services/secrets and exchanged with
|
|
111
|
+
* agents. Values are AES-256-GCM ciphertext; iv/authTag/ciphertext/dataKeyCiphertext
|
|
112
|
+
* are all base64-encoded.
|
|
113
|
+
*/
|
|
114
|
+
interface EncryptedEnvelopeV1 {
|
|
115
|
+
version: 1;
|
|
116
|
+
iv: string;
|
|
117
|
+
ciphertext: string;
|
|
118
|
+
authTag: string;
|
|
119
|
+
dataKeyCiphertext: string;
|
|
120
|
+
}
|
|
121
|
+
/** Opaque metadata about a secret row — never includes plaintext. */
|
|
122
|
+
interface SecretMetadata {
|
|
123
|
+
secretId: string;
|
|
124
|
+
secretName: string;
|
|
125
|
+
description?: string;
|
|
126
|
+
tags?: string[];
|
|
127
|
+
createdAt: string;
|
|
128
|
+
updatedAt: string;
|
|
129
|
+
rotatedAt?: string;
|
|
130
|
+
}
|
|
131
|
+
/** A single secret row including its encrypted envelope. */
|
|
132
|
+
interface SecretEnvelopeResponse extends SecretMetadata {
|
|
133
|
+
envelope: EncryptedEnvelopeV1;
|
|
134
|
+
}
|
|
135
|
+
/** A scope the caller can read or write secrets in. */
|
|
136
|
+
interface ScopeInfo {
|
|
137
|
+
scope: SecretScope;
|
|
138
|
+
scopeId: string;
|
|
139
|
+
name?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* KMS-issued data key, returned by the secrets service's
|
|
143
|
+
* `/secrets/generate-data-key` KMS proxy endpoint. The plaintext key is
|
|
144
|
+
* returned base64-encoded; callers MUST decode it to a Buffer and zero the
|
|
145
|
+
* Buffer after use — never keep the plaintext as a JS string.
|
|
146
|
+
*/
|
|
147
|
+
interface GeneratedDataKey {
|
|
148
|
+
plaintextKey: string;
|
|
149
|
+
dataKeyCiphertext: string;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=secrets.d.ts.map
|
|
152
|
+
//#endregion
|
|
98
153
|
//#region src/index.d.ts
|
|
99
154
|
interface AgentApiClientConfig {
|
|
100
155
|
apiKey: string;
|
|
@@ -117,6 +172,15 @@ declare class AgentApiClient {
|
|
|
117
172
|
integrations: RegistryEntry[];
|
|
118
173
|
}>;
|
|
119
174
|
getGoogleCredentials(): Promise<{
|
|
175
|
+
accounts?: {
|
|
176
|
+
email: string;
|
|
177
|
+
refreshToken: string;
|
|
178
|
+
clientId: string;
|
|
179
|
+
clientSecret: string;
|
|
180
|
+
enabledServices?: string[];
|
|
181
|
+
isDefault: boolean;
|
|
182
|
+
displayName?: string;
|
|
183
|
+
}[];
|
|
120
184
|
email: string;
|
|
121
185
|
refreshToken: string;
|
|
122
186
|
clientId: string;
|
|
@@ -124,6 +188,24 @@ declare class AgentApiClient {
|
|
|
124
188
|
projectId: string;
|
|
125
189
|
enabledServices?: string[];
|
|
126
190
|
}>;
|
|
191
|
+
disconnectGoogleAccount(email: string): Promise<{
|
|
192
|
+
accounts: {
|
|
193
|
+
email: string;
|
|
194
|
+
displayName?: string;
|
|
195
|
+
isDefault: boolean;
|
|
196
|
+
}[];
|
|
197
|
+
}>;
|
|
198
|
+
setDefaultGoogleAccount(email: string): Promise<{
|
|
199
|
+
accounts: {
|
|
200
|
+
email: string;
|
|
201
|
+
displayName?: string;
|
|
202
|
+
isDefault: boolean;
|
|
203
|
+
}[];
|
|
204
|
+
}>;
|
|
205
|
+
getGithubCredentials(): Promise<{
|
|
206
|
+
login: string;
|
|
207
|
+
accessToken: string;
|
|
208
|
+
}>;
|
|
127
209
|
getXeroCredentials(): Promise<{
|
|
128
210
|
accessToken: string;
|
|
129
211
|
accessTokenExpiresAt: string;
|
|
@@ -133,6 +215,73 @@ declare class AgentApiClient {
|
|
|
133
215
|
accessToken: string;
|
|
134
216
|
expiresAt: string;
|
|
135
217
|
}>;
|
|
218
|
+
getNotionCredentials(): Promise<{
|
|
219
|
+
accessToken: string;
|
|
220
|
+
workspaceId: string;
|
|
221
|
+
workspaceName: string;
|
|
222
|
+
}>;
|
|
223
|
+
getAtlassianCredentials(): Promise<{
|
|
224
|
+
accessToken: string;
|
|
225
|
+
refreshToken: string;
|
|
226
|
+
accessTokenExpiresAt: string;
|
|
227
|
+
cloudId: string;
|
|
228
|
+
siteName: string;
|
|
229
|
+
siteUrl: string;
|
|
230
|
+
email: string;
|
|
231
|
+
enabledProducts: string[];
|
|
232
|
+
}>;
|
|
233
|
+
refreshAtlassianToken(): Promise<{
|
|
234
|
+
accessToken: string;
|
|
235
|
+
expiresAt: string;
|
|
236
|
+
}>;
|
|
237
|
+
getMYOBCredentials(): Promise<{
|
|
238
|
+
accessToken: string;
|
|
239
|
+
accessTokenExpiresAt: string;
|
|
240
|
+
myobBusinessId: string;
|
|
241
|
+
clientId: string;
|
|
242
|
+
}>;
|
|
243
|
+
refreshMYOBToken(): Promise<{
|
|
244
|
+
accessToken: string;
|
|
245
|
+
expiresAt: string;
|
|
246
|
+
}>;
|
|
247
|
+
getTeamsCredentials(): Promise<{
|
|
248
|
+
agentId: string;
|
|
249
|
+
tenantId: string;
|
|
250
|
+
azureAppId: string;
|
|
251
|
+
azureBotId: string;
|
|
252
|
+
azureClientSecret: string;
|
|
253
|
+
botDisplayName?: string;
|
|
254
|
+
teamsTenantId?: string;
|
|
255
|
+
serviceUrl?: string;
|
|
256
|
+
}>;
|
|
257
|
+
sendTeamsMessage(data: {
|
|
258
|
+
conversationId: string;
|
|
259
|
+
text?: string;
|
|
260
|
+
adaptiveCard?: Record<string, unknown>;
|
|
261
|
+
}): Promise<{
|
|
262
|
+
ok: boolean;
|
|
263
|
+
activityId: string;
|
|
264
|
+
}>;
|
|
265
|
+
listTeamsChannels(): Promise<{
|
|
266
|
+
channels: {
|
|
267
|
+
id: string;
|
|
268
|
+
name: string;
|
|
269
|
+
description?: string;
|
|
270
|
+
}[];
|
|
271
|
+
}>;
|
|
272
|
+
presignAttachments(files: {
|
|
273
|
+
filename: string;
|
|
274
|
+
mimeType: string;
|
|
275
|
+
size: number;
|
|
276
|
+
}[]): Promise<{
|
|
277
|
+
attachments: {
|
|
278
|
+
id: string;
|
|
279
|
+
uploadUrl: string;
|
|
280
|
+
downloadUrl: string;
|
|
281
|
+
s3Key: string;
|
|
282
|
+
expiresAt: string;
|
|
283
|
+
}[];
|
|
284
|
+
}>;
|
|
136
285
|
recordActivity(data: {
|
|
137
286
|
userId?: string;
|
|
138
287
|
channel: string;
|
|
@@ -140,9 +289,169 @@ declare class AgentApiClient {
|
|
|
140
289
|
}): Promise<{
|
|
141
290
|
recorded: boolean;
|
|
142
291
|
}>;
|
|
292
|
+
/**
|
|
293
|
+
* Mint a fresh AES-256 data key for a new secret or rotation. The encryption
|
|
294
|
+
* context is rebuilt server-side from `auth.tenantId` + the body fields; the
|
|
295
|
+
* agent cannot forge context for a scope it doesn't own.
|
|
296
|
+
*/
|
|
297
|
+
generateSecretDataKey(args: {
|
|
298
|
+
scope: SecretScope;
|
|
299
|
+
scopeId: string;
|
|
300
|
+
secretId: string;
|
|
301
|
+
}): Promise<GeneratedDataKey>;
|
|
302
|
+
/**
|
|
303
|
+
* Unwrap a wrapped data key so the agent can decrypt the envelope locally.
|
|
304
|
+
* KMS Decrypt will fail with `InvalidCiphertextException` if the envelope
|
|
305
|
+
* was tampered with in a way that changes `{ tenantId, scope, scopeId, secretId }`.
|
|
306
|
+
*/
|
|
307
|
+
decryptSecretDataKey(args: {
|
|
308
|
+
scope: SecretScope;
|
|
309
|
+
scopeId: string;
|
|
310
|
+
secretId: string;
|
|
311
|
+
dataKeyCiphertext: string;
|
|
312
|
+
}): Promise<{
|
|
313
|
+
plaintextKey: string;
|
|
314
|
+
}>;
|
|
315
|
+
/** Upload a pre-encrypted envelope for a secret. */
|
|
316
|
+
putSecretEnvelope(args: {
|
|
317
|
+
scope: SecretScope;
|
|
318
|
+
scopeId: string;
|
|
319
|
+
secretId: string;
|
|
320
|
+
secretName: string;
|
|
321
|
+
envelope: EncryptedEnvelopeV1;
|
|
322
|
+
description?: string;
|
|
323
|
+
tags?: string[];
|
|
324
|
+
}): Promise<{
|
|
325
|
+
secretId: string;
|
|
326
|
+
}>;
|
|
327
|
+
/** Fetch the encrypted envelope for a single secret. */
|
|
328
|
+
getSecretEnvelope(args: {
|
|
329
|
+
scope: SecretScope;
|
|
330
|
+
scopeId: string;
|
|
331
|
+
secretId: string;
|
|
332
|
+
}): Promise<SecretEnvelopeResponse>;
|
|
333
|
+
/** List metadata (never envelopes) for secrets in a scope. */
|
|
334
|
+
listSecrets(args: {
|
|
335
|
+
scope: SecretScope;
|
|
336
|
+
scopeId: string;
|
|
337
|
+
}): Promise<SecretMetadata[]>;
|
|
338
|
+
/** Delete a secret. */
|
|
339
|
+
deleteSecret(args: {
|
|
340
|
+
scope: SecretScope;
|
|
341
|
+
scopeId: string;
|
|
342
|
+
secretId: string;
|
|
343
|
+
}): Promise<void>;
|
|
344
|
+
/** Enumerate scopes (org/team/project/agent) this agent can access. */
|
|
345
|
+
listSecretScopes(): Promise<ScopeInfo[]>;
|
|
346
|
+
resolveIdentity(args: {
|
|
347
|
+
platform: string;
|
|
348
|
+
platformId: string;
|
|
349
|
+
displayName?: string;
|
|
350
|
+
}): Promise<{
|
|
351
|
+
identityId: string | null;
|
|
352
|
+
status: string;
|
|
353
|
+
accessAllowed: boolean;
|
|
354
|
+
created?: boolean;
|
|
355
|
+
reason?: string;
|
|
356
|
+
}>;
|
|
357
|
+
enforcePolicy(args: {
|
|
358
|
+
platform: string;
|
|
359
|
+
senderId: string;
|
|
360
|
+
channelId?: string;
|
|
361
|
+
}): Promise<{
|
|
362
|
+
identityId: string | null;
|
|
363
|
+
orgId: string | null;
|
|
364
|
+
role: string | null;
|
|
365
|
+
allowedTools: string[];
|
|
366
|
+
deniedTools: string[];
|
|
367
|
+
identified: boolean;
|
|
368
|
+
}>;
|
|
369
|
+
checkToolPermission(args: {
|
|
370
|
+
platform: string;
|
|
371
|
+
senderId: string;
|
|
372
|
+
toolName: string;
|
|
373
|
+
toolArgs?: Record<string, unknown>;
|
|
374
|
+
channelId?: string;
|
|
375
|
+
}): Promise<{
|
|
376
|
+
allowed: boolean;
|
|
377
|
+
reason?: string;
|
|
378
|
+
}>;
|
|
379
|
+
searchIdentities(args?: {
|
|
380
|
+
q?: string;
|
|
381
|
+
status?: string;
|
|
382
|
+
tag?: string;
|
|
383
|
+
platform?: string;
|
|
384
|
+
limit?: number;
|
|
385
|
+
offset?: number;
|
|
386
|
+
}): Promise<{
|
|
387
|
+
identities: unknown[];
|
|
388
|
+
}>;
|
|
389
|
+
getIdentityContext(identityId: string): Promise<{
|
|
390
|
+
identity: unknown;
|
|
391
|
+
recentChanges: unknown[];
|
|
392
|
+
}>;
|
|
393
|
+
mergeIdentities(survivorId: string, args: {
|
|
394
|
+
mergedId: string;
|
|
395
|
+
changedBy: {
|
|
396
|
+
type: string;
|
|
397
|
+
id: string;
|
|
398
|
+
name?: string;
|
|
399
|
+
};
|
|
400
|
+
}): Promise<{
|
|
401
|
+
ok: boolean;
|
|
402
|
+
error?: string;
|
|
403
|
+
}>;
|
|
404
|
+
unmergeIdentity(identityId: string, args: {
|
|
405
|
+
changedBy: {
|
|
406
|
+
type: string;
|
|
407
|
+
id: string;
|
|
408
|
+
name?: string;
|
|
409
|
+
};
|
|
410
|
+
}): Promise<{
|
|
411
|
+
ok: boolean;
|
|
412
|
+
error?: string;
|
|
413
|
+
}>;
|
|
414
|
+
addIdentityNote(identityId: string, args: {
|
|
415
|
+
content: string;
|
|
416
|
+
category?: string;
|
|
417
|
+
changedBy: {
|
|
418
|
+
type: string;
|
|
419
|
+
id: string;
|
|
420
|
+
name?: string;
|
|
421
|
+
};
|
|
422
|
+
}): Promise<{
|
|
423
|
+
noteId: string | null;
|
|
424
|
+
}>;
|
|
425
|
+
tagIdentity(identityId: string, args: {
|
|
426
|
+
tag: string;
|
|
427
|
+
action: "add" | "remove";
|
|
428
|
+
changedBy: {
|
|
429
|
+
type: string;
|
|
430
|
+
id: string;
|
|
431
|
+
name?: string;
|
|
432
|
+
};
|
|
433
|
+
}): Promise<{
|
|
434
|
+
ok: boolean;
|
|
435
|
+
}>;
|
|
436
|
+
getIdentityChangelog(identityId: string, args?: {
|
|
437
|
+
limit?: number;
|
|
438
|
+
offset?: number;
|
|
439
|
+
}): Promise<{
|
|
440
|
+
entries: unknown[];
|
|
441
|
+
}>;
|
|
442
|
+
rollbackIdentity(identityId: string, args: {
|
|
443
|
+
targetVersion: number;
|
|
444
|
+
changedBy: {
|
|
445
|
+
type: string;
|
|
446
|
+
id: string;
|
|
447
|
+
name?: string;
|
|
448
|
+
};
|
|
449
|
+
}): Promise<{
|
|
450
|
+
ok: boolean;
|
|
451
|
+
entry?: unknown;
|
|
452
|
+
}>;
|
|
143
453
|
}
|
|
144
454
|
//# sourceMappingURL=index.d.ts.map
|
|
145
|
-
|
|
146
455
|
//#endregion
|
|
147
|
-
export { AgentApiClient, AgentApiClientConfig, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, type RegistryEntry };
|
|
456
|
+
export { AgentApiClient, AgentApiClientConfig, type EncryptedEnvelopeV1, type GeneratedDataKey, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, type RegistryEntry, type ScopeInfo, type SecretEnvelopeResponse, type SecretMetadata, type SecretScope };
|
|
148
457
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["DEFAULT_INTEGRATIONS","IntegrationVisibility","INTEGRATION_VISIBILITIES","IntegrationScope","INTEGRATION_SCOPES","IntegrationDesiredStatus","INTEGRATION_DESIRED_STATUSES","IntegrationActualStatus","INTEGRATION_ACTUAL_STATUSES","IntegrationInstall","Record","AgentIntegration","OrgIntegration","IntegrationConfigSchemaField","IntegrationConfigResult","RegistryEntry"],"sources":["../../../packages-internal/types/dist/integration.d.ts","../src/index.ts"],"sourcesContent":["/** 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), dev (non-prod only), hidden (nowhere) */\nexport declare const IntegrationVisibility: {\n readonly Public: \"public\";\n readonly Dev: \"dev\";\n readonly Hidden: \"hidden\";\n};\nexport type IntegrationVisibility = (typeof IntegrationVisibility)[keyof typeof IntegrationVisibility];\nexport declare const INTEGRATION_VISIBILITIES: readonly [\"dev\" | \"public\" | \"hidden\", ...(\"dev\" | \"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 = (typeof IntegrationScope)[keyof typeof IntegrationScope];\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 editable?: string;\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"],"mappings":";;AAQA;AAAiC,cALZC,qBAKY,EAAA;WAAWA,MAAAA,EAAAA,QAAAA;WAAoCA,GAAAA,EAAAA,KAAAA;EAAqB,SAAA,MAAA,EAAA,QAAA;AAGrG,CAAA;AAMYE,KATAF,qBAAAA,GASgB,CAAA,OATgBA,qBAShB,CAAA,CAAA,MAAA,OAToDA,qBASpD,CAAA;;AAA0CE,cANjDA,gBAMiDA,EAAAA;EAAgB,SAAA,GAAA,EAAA,KAAA;EAEjEE,SAAAA,IAAAA,EAAAA,MAAAA;EAITA,SAAAA,OAAAA,EAAAA,SAAwB;EAAA,SAAA,KAAA,EAAA,OAAA;;AAAkDA,KAN1EF,gBAAAA,GAM0EE,CAAAA,OAN/CF,gBAM+CE,CAAAA,CAAAA,MAAAA,OANhBF,gBAMgBE,CAAAA;AAEjEE,cANAF,wBAapB,EAAA;EACWE,SAAAA,MAAAA,EAAAA,QAAAA;EAAuB,SAAA,OAAA,EAAA,SAAA;;AAAiDA,KAVxEF,wBAAAA,GAUwEE,CAAAA,OAVrCF,wBAUqCE,CAAAA,CAAAA,MAAAA,OAVEF,wBAUFE,CAAAA;AAEnEE,cAVIF,uBAUc,EAAA;EAAA,SAAA,UAAA,EAAA,YAAA;WACxBJ,MAAAA,EAAAA,QAAAA;WAIQE,KAAAA,EAAAA,OAAAA;WACDE,QAAAA,EAAAA,UAAAA;WAENG,QAAAA,EAAAA,UAAAA;EAAM,SAAA,OAAA,EAAA,SAAA;AASlB,CAAA;AAeiBI,KAlCLP,uBAAAA,GAkC4B,CAAA,OAlCMA,uBAkCN,CAAA,CAAA,MAAA,OAlC4CA,uBAkC5C,CAAA;AAE5BG,UA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EC4B9B,OD5B8B,CAAA,IAAA,CAAA;EAAA,kBAAA,CAAA,aAAA,EAAA,MAAA,EAAA,OAAwE,CAAxE,EAAA;IAAWA,OAAAA,CAAAA,EAAAA,MAAAA;IAAsCA,MAAAA,CAAAA,ECwCzC,MDxCyCA,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;EAAuB,CAAA,CAAA,ECyCtG,ODzCsG,CCyC9F,kBDzC8F,CAAA;EAE1FE,iBAAAA,CAAAA,aAAkB,EAAA,MAAA,CAAA,ECkDe,ODlDf,CCkDuB,kBDlDvB,CAAA;EAAA,WAAA,CAAA,CAAA,ECyDZ,ODzDY,CAAA;IACxBN,YAAAA,ECwDoC,aDxDpCA,EAAAA;;sBAKOI,CAAAA,CAAAA,ECuDc,ODvDdA,CAAAA;IAENG,KAAAA,EAAAA,MAAAA;IAAM,YAAA,EAAA,MAAA;IASDG,QAAAA,EAAAA,MAAAA;IAeAC,YAAAA,EAAAA,MAAAA;IAAuB,SAAA,EAAA,MAAA;IAE5BJ,eAAAA,CAAAA,EAAAA,MAAAA,EAAAA;;EACkC,kBAAA,CAAA,CAAA,ECqChB,ODrCgB,CAAA;IAE7BK,WAAAA,EAAa,MAAA;IAAA,oBAAA,EAAA,MAAA;IAsBVF,YAAAA,EAAAA,MAAAA;;kBAKHZ,CAAAA,CAAAA,ECgBW,ODhBXA,CAAAA;IAAqB,WAAA,EAAA,MAAA;;;;IClFrB,MAAA,CAAA,EAAA,MAAA;IAKJ,OAAA,EAAA,MAAc;IAAA,IAAA,EAAA,MAAA,GAAA,WAAA;MAwGrB,OApGgB,CAAA;IAsBc,QAAA,EAAA,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["DEFAULT_INTEGRATIONS","IntegrationVisibility","INTEGRATION_VISIBILITIES","IntegrationScope","INTEGRATION_SCOPES","IntegrationDesiredStatus","INTEGRATION_DESIRED_STATUSES","IntegrationActualStatus","INTEGRATION_ACTUAL_STATUSES","IntegrationInstall","Record","AgentIntegration","OrgIntegration","IntegrationConfigSchemaField","IntegrationConfigResult","RegistryEntry","SecretScope","EncryptedEnvelopeV1","SecretMetadata","SecretEnvelopeResponse","ScopeInfo","GeneratedDataKey"],"sources":["../../../packages-internal/types/dist/integration.d.ts","../../../packages-internal/types/dist/secrets.d.ts","../src/index.ts"],"sourcesContent":["/** 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 = (typeof IntegrationScope)[keyof typeof IntegrationScope];\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 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 */\n/** Scope levels at which a secret can be owned. */\nexport type SecretScope = \"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":";;AAOA;AAAiC,cAJZC,qBAIY,EAAA;WAAWA,MAAAA,EAAAA,QAAAA;WAAoCA,MAAAA,EAAAA,QAAAA;CAAqB;AAGhFE,KAHTF,qBAAAA,GAQX,CAAA,OAR2CA,qBAQ3C,CAAA,CAAA,MAAA,OAR+EA,qBAQ/E,CAAA;;AACsCE,cANlBA,gBAMkBA,EAAAA;WAA+BA,GAAAA,EAAAA,KAAAA;EAAgB,SAAA,IAAA,EAAA,MAAA;EAEjEE,SAAAA,OAAAA,EAAAA,SAGpB;EACWA,SAAAA,KAAAA,EAAAA,OAAAA;CAAwB;AAAWA,KANnCF,gBAAAA,GAMmCE,CAAAA,OANRF,gBAMQE,CAAAA,CAAAA,MAAAA,OANuBF,gBAMvBE,CAAAA;AAA+D,cAJzFA,wBAIyF,EAAA;EAEzFE,SAAAA,MAAAA,EAAAA,QAAAA;EAQ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,QAAQ;;;;;MAc9B;;;;;;;;;;;MAiBA;;;;;;;;;;;;eAkBS;;MAET;;;;;;;;;;;MAcA;;;0CAY0C;;;;;;;;;;;MAU1C;;;;;;;;;;MASA;;;;;;;;;;;;MAWA;;;;;;;;;;;MAWA;;;;;;MAUA;;;;;;;;;;MAWA"}
|
package/dist/index.js
CHANGED
|
@@ -16,25 +16,25 @@ var AgentApiClient = class {
|
|
|
16
16
|
headers
|
|
17
17
|
});
|
|
18
18
|
if (!res.ok) {
|
|
19
|
-
|
|
20
|
-
throw new Error(`Agent API
|
|
19
|
+
await res.text();
|
|
20
|
+
throw new Error(`Agent API request failed (${String(res.status)})`);
|
|
21
21
|
}
|
|
22
22
|
return (await res.json()).data;
|
|
23
23
|
}
|
|
24
24
|
async listIntegrations() {
|
|
25
|
-
return this.request("/
|
|
25
|
+
return this.request("/agent/integrations");
|
|
26
26
|
}
|
|
27
27
|
async getIntegrationConfig(integrationId) {
|
|
28
|
-
return this.request(`/
|
|
28
|
+
return this.request(`/agent/integrations/${encodeURIComponent(integrationId)}/config`);
|
|
29
29
|
}
|
|
30
30
|
async updateIntegrationConfig(integrationId, config) {
|
|
31
|
-
await this.request(`/
|
|
31
|
+
await this.request(`/agent/integrations/${encodeURIComponent(integrationId)}`, {
|
|
32
32
|
method: "PATCH",
|
|
33
33
|
body: JSON.stringify({ config })
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
async installIntegration(integrationId, options) {
|
|
37
|
-
return this.request("/
|
|
37
|
+
return this.request("/agent/integrations", {
|
|
38
38
|
method: "POST",
|
|
39
39
|
body: JSON.stringify({
|
|
40
40
|
integrationId,
|
|
@@ -44,26 +44,183 @@ var AgentApiClient = class {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
async removeIntegration(integrationId) {
|
|
47
|
-
return this.request(`/
|
|
47
|
+
return this.request(`/agent/integrations/${encodeURIComponent(integrationId)}`, { method: "DELETE" });
|
|
48
48
|
}
|
|
49
49
|
async getRegistry() {
|
|
50
50
|
return this.request("/integrations/registry");
|
|
51
51
|
}
|
|
52
52
|
async getGoogleCredentials() {
|
|
53
|
-
return this.request("/
|
|
53
|
+
return this.request("/agent/google/credentials");
|
|
54
|
+
}
|
|
55
|
+
async disconnectGoogleAccount(email) {
|
|
56
|
+
return this.request(`/agent/google/accounts/${encodeURIComponent(email)}`, { method: "DELETE" });
|
|
57
|
+
}
|
|
58
|
+
async setDefaultGoogleAccount(email) {
|
|
59
|
+
return this.request(`/agent/google/accounts/${encodeURIComponent(email)}/default`, { method: "PUT" });
|
|
60
|
+
}
|
|
61
|
+
async getGithubCredentials() {
|
|
62
|
+
return this.request("/agent/github/credentials");
|
|
54
63
|
}
|
|
55
64
|
async getXeroCredentials() {
|
|
56
|
-
return this.request("/
|
|
65
|
+
return this.request("/agent/xero/credentials");
|
|
57
66
|
}
|
|
58
67
|
async refreshXeroToken() {
|
|
59
|
-
return this.request("/
|
|
68
|
+
return this.request("/agent/xero/token", { method: "POST" });
|
|
69
|
+
}
|
|
70
|
+
async getNotionCredentials() {
|
|
71
|
+
return this.request("/agent/notion/credentials");
|
|
72
|
+
}
|
|
73
|
+
async getAtlassianCredentials() {
|
|
74
|
+
return this.request("/agent/atlassian/credentials");
|
|
75
|
+
}
|
|
76
|
+
async refreshAtlassianToken() {
|
|
77
|
+
return this.request("/agent/atlassian/token", { method: "POST" });
|
|
78
|
+
}
|
|
79
|
+
async getMYOBCredentials() {
|
|
80
|
+
return this.request("/agent/myob/credentials");
|
|
81
|
+
}
|
|
82
|
+
async refreshMYOBToken() {
|
|
83
|
+
return this.request("/agent/myob/token", { method: "POST" });
|
|
84
|
+
}
|
|
85
|
+
async getTeamsCredentials() {
|
|
86
|
+
return this.request("/agent/microsoft/credentials");
|
|
87
|
+
}
|
|
88
|
+
async sendTeamsMessage(data) {
|
|
89
|
+
return this.request("/agent/microsoft/send", {
|
|
90
|
+
method: "POST",
|
|
91
|
+
body: JSON.stringify(data)
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async listTeamsChannels() {
|
|
95
|
+
return this.request("/agent/microsoft/channels");
|
|
96
|
+
}
|
|
97
|
+
async presignAttachments(files) {
|
|
98
|
+
return this.request("/agent/chat/attachments/presign", {
|
|
99
|
+
method: "POST",
|
|
100
|
+
body: JSON.stringify({ files })
|
|
101
|
+
});
|
|
60
102
|
}
|
|
61
103
|
async recordActivity(data) {
|
|
62
|
-
return this.request("/
|
|
104
|
+
return this.request("/agent/activity", {
|
|
63
105
|
method: "POST",
|
|
64
106
|
body: JSON.stringify(data)
|
|
65
107
|
});
|
|
66
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Mint a fresh AES-256 data key for a new secret or rotation. The encryption
|
|
111
|
+
* context is rebuilt server-side from `auth.tenantId` + the body fields; the
|
|
112
|
+
* agent cannot forge context for a scope it doesn't own.
|
|
113
|
+
*/
|
|
114
|
+
async generateSecretDataKey(args) {
|
|
115
|
+
return this.request("/agent/secrets/generate-data-key", {
|
|
116
|
+
method: "POST",
|
|
117
|
+
body: JSON.stringify(args)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Unwrap a wrapped data key so the agent can decrypt the envelope locally.
|
|
122
|
+
* KMS Decrypt will fail with `InvalidCiphertextException` if the envelope
|
|
123
|
+
* was tampered with in a way that changes `{ tenantId, scope, scopeId, secretId }`.
|
|
124
|
+
*/
|
|
125
|
+
async decryptSecretDataKey(args) {
|
|
126
|
+
return this.request("/agent/secrets/decrypt-data-key", {
|
|
127
|
+
method: "POST",
|
|
128
|
+
body: JSON.stringify(args)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/** Upload a pre-encrypted envelope for a secret. */
|
|
132
|
+
async putSecretEnvelope(args) {
|
|
133
|
+
const { scope, scopeId, secretId, ...body } = args;
|
|
134
|
+
return this.request(`/agent/secrets/${encodeURIComponent(scope)}/${encodeURIComponent(scopeId)}/${encodeURIComponent(secretId)}`, {
|
|
135
|
+
method: "PUT",
|
|
136
|
+
body: JSON.stringify(body)
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/** Fetch the encrypted envelope for a single secret. */
|
|
140
|
+
async getSecretEnvelope(args) {
|
|
141
|
+
return this.request(`/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/${encodeURIComponent(args.secretId)}`);
|
|
142
|
+
}
|
|
143
|
+
/** List metadata (never envelopes) for secrets in a scope. */
|
|
144
|
+
async listSecrets(args) {
|
|
145
|
+
return (await this.request(`/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}`)).secrets;
|
|
146
|
+
}
|
|
147
|
+
/** Delete a secret. */
|
|
148
|
+
async deleteSecret(args) {
|
|
149
|
+
await this.request(`/agent/secrets/${encodeURIComponent(args.scope)}/${encodeURIComponent(args.scopeId)}/${encodeURIComponent(args.secretId)}`, { method: "DELETE" });
|
|
150
|
+
}
|
|
151
|
+
/** Enumerate scopes (org/team/project/agent) this agent can access. */
|
|
152
|
+
async listSecretScopes() {
|
|
153
|
+
return (await this.request("/agent/secrets/scopes")).scopes;
|
|
154
|
+
}
|
|
155
|
+
async resolveIdentity(args) {
|
|
156
|
+
return this.request("/agent/identity/resolve", {
|
|
157
|
+
method: "POST",
|
|
158
|
+
body: JSON.stringify(args)
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
async enforcePolicy(args) {
|
|
162
|
+
return this.request("/agent/identity/enforce", {
|
|
163
|
+
method: "POST",
|
|
164
|
+
body: JSON.stringify(args)
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
async checkToolPermission(args) {
|
|
168
|
+
return this.request("/agent/identity/check-tool", {
|
|
169
|
+
method: "POST",
|
|
170
|
+
body: JSON.stringify(args)
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
async searchIdentities(args) {
|
|
174
|
+
const qs = new URLSearchParams();
|
|
175
|
+
if (args?.q) qs.set("q", args.q);
|
|
176
|
+
if (args?.status) qs.set("status", args.status);
|
|
177
|
+
if (args?.tag) qs.set("tag", args.tag);
|
|
178
|
+
if (args?.platform) qs.set("platform", args.platform);
|
|
179
|
+
if (args?.limit) qs.set("limit", String(args.limit));
|
|
180
|
+
if (args?.offset) qs.set("offset", String(args.offset));
|
|
181
|
+
const query = qs.toString();
|
|
182
|
+
return this.request(`/agent/identity/search${query ? `?${query}` : ""}`);
|
|
183
|
+
}
|
|
184
|
+
async getIdentityContext(identityId) {
|
|
185
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/context`);
|
|
186
|
+
}
|
|
187
|
+
async mergeIdentities(survivorId, args) {
|
|
188
|
+
return this.request(`/agent/identity/${encodeURIComponent(survivorId)}/merge`, {
|
|
189
|
+
method: "POST",
|
|
190
|
+
body: JSON.stringify(args)
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
async unmergeIdentity(identityId, args) {
|
|
194
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/unmerge`, {
|
|
195
|
+
method: "POST",
|
|
196
|
+
body: JSON.stringify(args)
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
async addIdentityNote(identityId, args) {
|
|
200
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/notes`, {
|
|
201
|
+
method: "POST",
|
|
202
|
+
body: JSON.stringify(args)
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
async tagIdentity(identityId, args) {
|
|
206
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/tags`, {
|
|
207
|
+
method: "POST",
|
|
208
|
+
body: JSON.stringify(args)
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
async getIdentityChangelog(identityId, args) {
|
|
212
|
+
const qs = new URLSearchParams();
|
|
213
|
+
if (args?.limit) qs.set("limit", String(args.limit));
|
|
214
|
+
if (args?.offset) qs.set("offset", String(args.offset));
|
|
215
|
+
const query = qs.toString();
|
|
216
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/changelog${query ? `?${query}` : ""}`);
|
|
217
|
+
}
|
|
218
|
+
async rollbackIdentity(identityId, args) {
|
|
219
|
+
return this.request(`/agent/identity/${encodeURIComponent(identityId)}/rollback`, {
|
|
220
|
+
method: "POST",
|
|
221
|
+
body: JSON.stringify(args)
|
|
222
|
+
});
|
|
223
|
+
}
|
|
67
224
|
};
|
|
68
225
|
//#endregion
|
|
69
226
|
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 /agents/ 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} from \"@alfe/types\";\n\nimport type { IntegrationInstall, IntegrationConfigResult, RegistryEntry } 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 const body = await res.text();\n throw new Error(`Agent API error ${String(res.status)}: ${body}`);\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[]>(\"/agents/integrations\");\n }\n\n async getIntegrationConfig(integrationId: string): Promise<IntegrationConfigResult> {\n return this.request<IntegrationConfigResult>(\n `/agents/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 `/agents/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>(\"/agents/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 `/agents/integrations/${encodeURIComponent(integrationId)}`,\n { method: \"DELETE\" },\n );\n }\n\n async getRegistry(): Promise<{ integrations: RegistryEntry[] }> {\n return this.request<{ integrations: RegistryEntry[] }>(\"/integrations/registry\");\n }\n\n async getGoogleCredentials(): Promise<{\n email: string;\n refreshToken: string;\n clientId: string;\n clientSecret: string;\n projectId: string;\n enabledServices?: string[];\n }> {\n return this.request(\"/agents/google/credentials\");\n }\n\n async getXeroCredentials(): Promise<{\n accessToken: string;\n accessTokenExpiresAt: string;\n xeroTenantId: string;\n }> {\n return this.request(\"/agents/xero/credentials\");\n }\n\n async refreshXeroToken(): Promise<{\n accessToken: string;\n expiresAt: string;\n }> {\n return this.request(\"/agents/xero/token\", { method: \"POST\" });\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 }>(\"/agents/activity\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n }\n}\n"],"mappings":";AAsBA,IAAa,iBAAb,MAA4B;CAC1B;CACA;CAEA,YAAY,QAA8B;AACxC,OAAK,SAAS,OAAO;AACrB,OAAK,SAAS,OAAO;;CAGvB,MAAc,QAAW,MAAc,SAAmC;EACxE,MAAM,MAA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SAAO,KAAK,QAA+B,oBAAoB;GAC7D,QAAQ;GACR,MAAM,KAAK,UAAU,KAAK;GAC3B,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\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 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 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 }> {\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"],"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,KAA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