computer-agents 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -18
- package/dist/ComputerAgentsClient.d.ts +42 -17
- package/dist/ComputerAgentsClient.js +39 -22
- package/dist/ComputerAgentsClient.js.map +1 -1
- package/dist/cloud/resources/AgentsResource.d.ts +12 -1
- package/dist/cloud/resources/AgentsResource.js +16 -0
- package/dist/cloud/resources/AgentsResource.js.map +1 -1
- package/dist/cloud/resources/DatabasesResource.d.ts +36 -0
- package/dist/cloud/resources/DatabasesResource.js +68 -0
- package/dist/cloud/resources/DatabasesResource.js.map +1 -0
- package/dist/cloud/resources/EnvironmentsResource.d.ts +110 -0
- package/dist/cloud/resources/EnvironmentsResource.js +75 -0
- package/dist/cloud/resources/EnvironmentsResource.js.map +1 -1
- package/dist/cloud/resources/GitResource.d.ts +60 -2
- package/dist/cloud/resources/GitResource.js +86 -10
- package/dist/cloud/resources/GitResource.js.map +1 -1
- package/dist/cloud/resources/ResourcesResource.d.ts +92 -0
- package/dist/cloud/resources/ResourcesResource.js +151 -0
- package/dist/cloud/resources/ResourcesResource.js.map +1 -0
- package/dist/cloud/resources/SkillsResource.d.ts +17 -0
- package/dist/cloud/resources/SkillsResource.js +36 -0
- package/dist/cloud/resources/SkillsResource.js.map +1 -0
- package/dist/cloud/resources/ThreadsResource.d.ts +78 -0
- package/dist/cloud/resources/ThreadsResource.js +64 -0
- package/dist/cloud/resources/ThreadsResource.js.map +1 -1
- package/dist/cloud/resources/index.d.ts +7 -1
- package/dist/cloud/resources/index.js +9 -3
- package/dist/cloud/resources/index.js.map +1 -1
- package/dist/cloud/types.d.ts +185 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatabasesResource.js","sourceRoot":"","sources":["../../../src/cloud/resources/Databas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AkB,EAClB,YAAoB,EACpB,UAAkB;QAElB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACpC,cAAc,UAAU,gBAAgB,YAAY,cAAc,UAAU,EAAE,CAC/E,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,MAAoC;QAEpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACpC,cAAc,UAAU,gBAAgB,YAAY,cAAc,UAAU,EAAE,EAC9E,MAAM,CACP,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,UAAkB,EAClB,YAAoB,EACpB,UAAkB;QAElB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CACvC,cAAc,UAAU,gBAAgB,YAAY,cAAc,UAAU,EAAE,CAC/E,CAAC;QACF,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;CACF;AAnHD,8CAmHC"}
|
|
@@ -15,6 +15,40 @@ export interface ListEnvironmentsParams {
|
|
|
15
15
|
limit?: number;
|
|
16
16
|
offset?: number;
|
|
17
17
|
}
|
|
18
|
+
export interface EnvironmentSnapshot {
|
|
19
|
+
id: string;
|
|
20
|
+
environmentId: string;
|
|
21
|
+
sourceThreadId?: string | null;
|
|
22
|
+
sourceStepId?: string | null;
|
|
23
|
+
parentSnapshotId?: string | null;
|
|
24
|
+
ledgerCommitSha?: string;
|
|
25
|
+
changedPaths?: string[];
|
|
26
|
+
additions?: number;
|
|
27
|
+
deletions?: number;
|
|
28
|
+
metadata?: Record<string, unknown> | null;
|
|
29
|
+
createdAt?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface EnvironmentAnalyticsResponse {
|
|
32
|
+
environmentId: string;
|
|
33
|
+
available?: boolean;
|
|
34
|
+
summary?: Record<string, unknown>;
|
|
35
|
+
charts?: Record<string, unknown>;
|
|
36
|
+
recentRuns?: Array<Record<string, unknown>>;
|
|
37
|
+
}
|
|
38
|
+
export interface EnvironmentSecretDescriptor {
|
|
39
|
+
key: string;
|
|
40
|
+
hasValue: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface EnvironmentGuiActionParams {
|
|
43
|
+
action: 'click' | 'double_click' | 'right_click' | 'scroll' | 'key' | 'type' | 'bootstrap' | 'launch_app';
|
|
44
|
+
x?: number;
|
|
45
|
+
y?: number;
|
|
46
|
+
deltaY?: number;
|
|
47
|
+
steps?: number;
|
|
48
|
+
key?: string;
|
|
49
|
+
text?: string;
|
|
50
|
+
app?: string;
|
|
51
|
+
}
|
|
18
52
|
export declare class EnvironmentsResource {
|
|
19
53
|
private readonly client;
|
|
20
54
|
constructor(client: ApiClient);
|
|
@@ -39,6 +73,10 @@ export declare class EnvironmentsResource {
|
|
|
39
73
|
* Creates one if it doesn't exist.
|
|
40
74
|
*/
|
|
41
75
|
getDefault(): Promise<Environment>;
|
|
76
|
+
/**
|
|
77
|
+
* Mark an environment as the default computer for the current user.
|
|
78
|
+
*/
|
|
79
|
+
setDefault(environmentId: string): Promise<Environment>;
|
|
42
80
|
/**
|
|
43
81
|
* Update an environment
|
|
44
82
|
*/
|
|
@@ -156,6 +194,78 @@ export declare class EnvironmentsResource {
|
|
|
156
194
|
* Get container status for an environment
|
|
157
195
|
*/
|
|
158
196
|
getStatus(environmentId: string): Promise<ContainerStatus>;
|
|
197
|
+
/**
|
|
198
|
+
* Get runtime analytics for the computer.
|
|
199
|
+
*/
|
|
200
|
+
getAnalytics(environmentId: string): Promise<EnvironmentAnalyticsResponse>;
|
|
201
|
+
/**
|
|
202
|
+
* Capture a desktop screenshot from the computer.
|
|
203
|
+
*/
|
|
204
|
+
captureScreenshot(environmentId: string): Promise<Buffer>;
|
|
205
|
+
/**
|
|
206
|
+
* Create a browser/desktop session token for GUI streaming.
|
|
207
|
+
*/
|
|
208
|
+
createGuiSession(environmentId: string): Promise<{
|
|
209
|
+
token: string;
|
|
210
|
+
websocketPath: string;
|
|
211
|
+
expiresAt: string;
|
|
212
|
+
}>;
|
|
213
|
+
/**
|
|
214
|
+
* Execute a GUI action in the computer session.
|
|
215
|
+
*/
|
|
216
|
+
performGuiAction(environmentId: string, params: EnvironmentGuiActionParams): Promise<{
|
|
217
|
+
ok: boolean;
|
|
218
|
+
action: string;
|
|
219
|
+
}>;
|
|
220
|
+
/**
|
|
221
|
+
* List configured secret keys for the computer.
|
|
222
|
+
*/
|
|
223
|
+
listSecrets(environmentId: string): Promise<EnvironmentSecretDescriptor[]>;
|
|
224
|
+
createSecret(environmentId: string, key: string, value: string): Promise<{
|
|
225
|
+
success?: boolean;
|
|
226
|
+
key: string;
|
|
227
|
+
message?: string;
|
|
228
|
+
}>;
|
|
229
|
+
updateSecret(environmentId: string, key: string, value: string): Promise<{
|
|
230
|
+
success?: boolean;
|
|
231
|
+
key: string;
|
|
232
|
+
message?: string;
|
|
233
|
+
}>;
|
|
234
|
+
deleteSecret(environmentId: string, key: string): Promise<{
|
|
235
|
+
success?: boolean;
|
|
236
|
+
key: string;
|
|
237
|
+
message?: string;
|
|
238
|
+
}>;
|
|
239
|
+
/**
|
|
240
|
+
* Initialize snapshot history for a computer.
|
|
241
|
+
*/
|
|
242
|
+
initializeSnapshots(environmentId: string): Promise<{
|
|
243
|
+
environmentId: string;
|
|
244
|
+
snapshot: EnvironmentSnapshot;
|
|
245
|
+
}>;
|
|
246
|
+
/**
|
|
247
|
+
* List checkpoint snapshots for a computer.
|
|
248
|
+
*/
|
|
249
|
+
listSnapshots(environmentId: string): Promise<EnvironmentSnapshot[]>;
|
|
250
|
+
listSnapshotFiles(environmentId: string, snapshotId: string, params?: {
|
|
251
|
+
prefix?: string;
|
|
252
|
+
}): Promise<Array<Record<string, unknown>>>;
|
|
253
|
+
getSnapshotDiff(environmentId: string, snapshotId: string, params?: {
|
|
254
|
+
path?: string;
|
|
255
|
+
}): Promise<Record<string, unknown>>;
|
|
256
|
+
getSnapshotFile(environmentId: string, snapshotId: string, path: string): Promise<{
|
|
257
|
+
path: string;
|
|
258
|
+
snapshotId: string;
|
|
259
|
+
content: string;
|
|
260
|
+
}>;
|
|
261
|
+
forkFromSnapshot(environmentId: string, snapshotId: string, params?: {
|
|
262
|
+
name?: string;
|
|
263
|
+
description?: string;
|
|
264
|
+
}): Promise<{
|
|
265
|
+
environment: Environment;
|
|
266
|
+
snapshot?: EnvironmentSnapshot;
|
|
267
|
+
sourceSnapshotId?: string;
|
|
268
|
+
}>;
|
|
159
269
|
/**
|
|
160
270
|
* Get the agent configuration for an environment
|
|
161
271
|
*/
|
|
@@ -58,6 +58,13 @@ class EnvironmentsResource {
|
|
|
58
58
|
const response = await this.client.get(`/environments/default`);
|
|
59
59
|
return response;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Mark an environment as the default computer for the current user.
|
|
63
|
+
*/
|
|
64
|
+
async setDefault(environmentId) {
|
|
65
|
+
const response = await this.client.post(`/environments/${environmentId}/set-default`, {});
|
|
66
|
+
return response.environment;
|
|
67
|
+
}
|
|
61
68
|
/**
|
|
62
69
|
* Update an environment
|
|
63
70
|
*/
|
|
@@ -235,6 +242,74 @@ class EnvironmentsResource {
|
|
|
235
242
|
const response = await this.client.get(`/environments/${environmentId}/status`);
|
|
236
243
|
return response;
|
|
237
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Get runtime analytics for the computer.
|
|
247
|
+
*/
|
|
248
|
+
async getAnalytics(environmentId) {
|
|
249
|
+
return this.client.get(`/environments/${environmentId}/analytics`);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Capture a desktop screenshot from the computer.
|
|
253
|
+
*/
|
|
254
|
+
async captureScreenshot(environmentId) {
|
|
255
|
+
const response = await this.client.request('GET', `/environments/${environmentId}/gui/screenshot`, { stream: true });
|
|
256
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
257
|
+
return Buffer.from(arrayBuffer);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Create a browser/desktop session token for GUI streaming.
|
|
261
|
+
*/
|
|
262
|
+
async createGuiSession(environmentId) {
|
|
263
|
+
return this.client.post(`/environments/${environmentId}/gui/session`, {});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Execute a GUI action in the computer session.
|
|
267
|
+
*/
|
|
268
|
+
async performGuiAction(environmentId, params) {
|
|
269
|
+
return this.client.post(`/environments/${environmentId}/gui/action`, params);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* List configured secret keys for the computer.
|
|
273
|
+
*/
|
|
274
|
+
async listSecrets(environmentId) {
|
|
275
|
+
const response = await this.client.get(`/environments/${environmentId}/secrets`);
|
|
276
|
+
return response.data;
|
|
277
|
+
}
|
|
278
|
+
async createSecret(environmentId, key, value) {
|
|
279
|
+
return this.client.post(`/environments/${environmentId}/secrets`, { key, value });
|
|
280
|
+
}
|
|
281
|
+
async updateSecret(environmentId, key, value) {
|
|
282
|
+
return this.client.put(`/environments/${environmentId}/secrets/${encodeURIComponent(key)}`, { value });
|
|
283
|
+
}
|
|
284
|
+
async deleteSecret(environmentId, key) {
|
|
285
|
+
return this.client.delete(`/environments/${environmentId}/secrets/${encodeURIComponent(key)}`);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Initialize snapshot history for a computer.
|
|
289
|
+
*/
|
|
290
|
+
async initializeSnapshots(environmentId) {
|
|
291
|
+
return this.client.post(`/environments/${environmentId}/snapshots/initialize`, {});
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* List checkpoint snapshots for a computer.
|
|
295
|
+
*/
|
|
296
|
+
async listSnapshots(environmentId) {
|
|
297
|
+
const response = await this.client.get(`/environments/${environmentId}/snapshots`);
|
|
298
|
+
return response.data;
|
|
299
|
+
}
|
|
300
|
+
async listSnapshotFiles(environmentId, snapshotId, params = {}) {
|
|
301
|
+
const response = await this.client.get(`/environments/${environmentId}/snapshots/${snapshotId}/files`, params);
|
|
302
|
+
return response.data;
|
|
303
|
+
}
|
|
304
|
+
async getSnapshotDiff(environmentId, snapshotId, params = {}) {
|
|
305
|
+
return this.client.get(`/environments/${environmentId}/snapshots/${snapshotId}/diff`, params);
|
|
306
|
+
}
|
|
307
|
+
async getSnapshotFile(environmentId, snapshotId, path) {
|
|
308
|
+
return this.client.get(`/environments/${environmentId}/snapshots/${snapshotId}/file`, { path });
|
|
309
|
+
}
|
|
310
|
+
async forkFromSnapshot(environmentId, snapshotId, params = {}) {
|
|
311
|
+
return this.client.post(`/environments/${environmentId}/snapshots/${snapshotId}/fork`, params);
|
|
312
|
+
}
|
|
238
313
|
// =========================================================================
|
|
239
314
|
// Configuration Management
|
|
240
315
|
// =========================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentsResource.js","sourceRoot":"","sources":["../../../src/cloud/resources/EnvironmentsResource.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;
|
|
1
|
+
{"version":3,"file":"EnvironmentsResource.js","sourceRoot":"","sources":["../../../src/cloud/resources/EnvironmentsResource.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAoEH,MAAa,oBAAoB;IACF;IAA7B,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAElD;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,MAA+B;QAC1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACrC,eAAe,EACf,MAAM,CACP,CAAC;QACF,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,MAA+B;QACxC,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,IAAI,M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AK,CAAC,YAAY,CAChB,aAAqB,EACrB,MAAc;QAEd,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACnB,iBAAiB,aAAa,SAAS,EACvC,EAAE,MAAM,EAAE,CACX,CAAC;IACJ,CAAC;CACF;AAjfD,oDAifC"}
|
|
@@ -6,13 +6,47 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { ApiClient } from '../ApiClient';
|
|
8
8
|
import type { GitDiffResult, GitCommitParams, GitCommitResult, GitPushParams, GitPushResult } from '../types';
|
|
9
|
+
export interface GitStatusResult {
|
|
10
|
+
isGitRepo: boolean;
|
|
11
|
+
path?: string;
|
|
12
|
+
message?: string | null;
|
|
13
|
+
branch?: string | null;
|
|
14
|
+
remoteUrl?: string | null;
|
|
15
|
+
changedFiles?: Array<Record<string, unknown>>;
|
|
16
|
+
stagedFiles?: Array<Record<string, unknown>>;
|
|
17
|
+
unstagedFiles?: Array<Record<string, unknown>>;
|
|
18
|
+
hasChanges?: boolean;
|
|
19
|
+
hasStagedChanges?: boolean;
|
|
20
|
+
hasUnstagedChanges?: boolean;
|
|
21
|
+
hasUnpushedCommits?: boolean;
|
|
22
|
+
}
|
|
9
23
|
export declare class GitResource {
|
|
10
24
|
private readonly client;
|
|
11
25
|
constructor(client: ApiClient);
|
|
12
26
|
/**
|
|
13
|
-
*
|
|
27
|
+
* Compatibility alias for Git status on a computer workspace.
|
|
14
28
|
*/
|
|
15
29
|
diff(workspaceId: string): Promise<GitDiffResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Get Git status for a computer workspace or repository path.
|
|
32
|
+
*/
|
|
33
|
+
getStatus(environmentId: string, path?: string): Promise<GitStatusResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Stage files before committing.
|
|
36
|
+
*/
|
|
37
|
+
stage(environmentId: string, params?: {
|
|
38
|
+
files?: string[];
|
|
39
|
+
path?: string;
|
|
40
|
+
all?: boolean;
|
|
41
|
+
}): Promise<Record<string, unknown>>;
|
|
42
|
+
/**
|
|
43
|
+
* Unstage previously staged files.
|
|
44
|
+
*/
|
|
45
|
+
unstage(environmentId: string, params?: {
|
|
46
|
+
files?: string[];
|
|
47
|
+
path?: string;
|
|
48
|
+
all?: boolean;
|
|
49
|
+
}): Promise<Record<string, unknown>>;
|
|
16
50
|
/**
|
|
17
51
|
* Create a git commit
|
|
18
52
|
*/
|
|
@@ -22,7 +56,31 @@ export declare class GitResource {
|
|
|
22
56
|
*/
|
|
23
57
|
push(workspaceId: string, params?: GitPushParams): Promise<GitPushResult>;
|
|
24
58
|
/**
|
|
25
|
-
*
|
|
59
|
+
* Create a branch inside a computer workspace.
|
|
60
|
+
*/
|
|
61
|
+
createBranch(environmentId: string, name: string, path?: string): Promise<Record<string, unknown>>;
|
|
62
|
+
/**
|
|
63
|
+
* Switch the active branch in a computer workspace.
|
|
64
|
+
*/
|
|
65
|
+
switchBranch(environmentId: string, name: string, path?: string): Promise<Record<string, unknown>>;
|
|
66
|
+
listBranches(environmentId: string, path?: string): Promise<Record<string, unknown>>;
|
|
67
|
+
listCommits(environmentId: string, params?: {
|
|
68
|
+
path?: string;
|
|
69
|
+
limit?: number;
|
|
70
|
+
}): Promise<Record<string, unknown>>;
|
|
71
|
+
prepareGithub(environmentId: string, params: {
|
|
72
|
+
repoFullName: string;
|
|
73
|
+
branch?: string;
|
|
74
|
+
}): Promise<Record<string, unknown>>;
|
|
75
|
+
clone(environmentId: string, params: {
|
|
76
|
+
repoUrl: string;
|
|
77
|
+
branch?: string;
|
|
78
|
+
targetPath?: string;
|
|
79
|
+
token?: string | null;
|
|
80
|
+
}): Promise<Record<string, unknown>>;
|
|
81
|
+
/**
|
|
82
|
+
* Commit diffs are no longer exposed as a standalone public ACP route.
|
|
83
|
+
* Use thread steps, thread diffs, or environment snapshot diffs instead.
|
|
26
84
|
*/
|
|
27
85
|
getCommitDiff(workspaceId: string, commitSha: string): Promise<GitDiffResult>;
|
|
28
86
|
}
|
|
@@ -13,32 +13,108 @@ class GitResource {
|
|
|
13
13
|
this.client = client;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Compatibility alias for Git status on a computer workspace.
|
|
17
17
|
*/
|
|
18
18
|
async diff(workspaceId) {
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
const status = await this.getStatus(workspaceId);
|
|
20
|
+
const files = status.changedFiles ?? [];
|
|
21
|
+
return {
|
|
22
|
+
diffs: files.map((file) => ({
|
|
23
|
+
path: String(file.path ?? ''),
|
|
24
|
+
additions: 0,
|
|
25
|
+
deletions: 0,
|
|
26
|
+
changes: String(file.status ?? 'modified'),
|
|
27
|
+
})),
|
|
28
|
+
stats: {
|
|
29
|
+
filesChanged: files.length,
|
|
30
|
+
insertions: 0,
|
|
31
|
+
deletions: 0,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get Git status for a computer workspace or repository path.
|
|
37
|
+
*/
|
|
38
|
+
async getStatus(environmentId, path) {
|
|
39
|
+
return this.client.get(`/environments/${environmentId}/git/status`, path ? { path } : undefined);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Stage files before committing.
|
|
43
|
+
*/
|
|
44
|
+
async stage(environmentId, params = {}) {
|
|
45
|
+
return this.client.post(`/environments/${environmentId}/git/stage`, params);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Unstage previously staged files.
|
|
49
|
+
*/
|
|
50
|
+
async unstage(environmentId, params = {}) {
|
|
51
|
+
return this.client.post(`/environments/${environmentId}/git/unstage`, params);
|
|
21
52
|
}
|
|
22
53
|
/**
|
|
23
54
|
* Create a git commit
|
|
24
55
|
*/
|
|
25
56
|
async commit(workspaceId, params) {
|
|
26
|
-
|
|
27
|
-
|
|
57
|
+
if (params.files?.length) {
|
|
58
|
+
await this.stage(workspaceId, { files: params.files });
|
|
59
|
+
}
|
|
60
|
+
const response = await this.client.post(`/environments/${workspaceId}/git/commit`, { message: params.message });
|
|
61
|
+
return {
|
|
62
|
+
success: !!response.success,
|
|
63
|
+
commit: {
|
|
64
|
+
sha: String(response.sha ?? ''),
|
|
65
|
+
message: String(response.message ?? params.message),
|
|
66
|
+
author: params.author ?? { name: '', email: '' },
|
|
67
|
+
timestamp: new Date().toISOString(),
|
|
68
|
+
filesChanged: params.files?.length ?? 0,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
28
71
|
}
|
|
29
72
|
/**
|
|
30
73
|
* Push commits to remote
|
|
31
74
|
*/
|
|
32
75
|
async push(workspaceId, params = {}) {
|
|
33
|
-
const response = await this.client.post(`/
|
|
34
|
-
return
|
|
76
|
+
const response = await this.client.post(`/environments/${workspaceId}/git/push`, params);
|
|
77
|
+
return {
|
|
78
|
+
success: !!response.success,
|
|
79
|
+
push: {
|
|
80
|
+
remote: 'origin',
|
|
81
|
+
branch: String(response.branch ?? params.branch ?? ''),
|
|
82
|
+
commits: 0,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Create a branch inside a computer workspace.
|
|
88
|
+
*/
|
|
89
|
+
async createBranch(environmentId, name, path) {
|
|
90
|
+
return this.client.post(`/environments/${environmentId}/git/branch`, { name, path });
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Switch the active branch in a computer workspace.
|
|
94
|
+
*/
|
|
95
|
+
async switchBranch(environmentId, name, path) {
|
|
96
|
+
return this.client.put(`/environments/${environmentId}/git/branch`, { name, path });
|
|
97
|
+
}
|
|
98
|
+
async listBranches(environmentId, path) {
|
|
99
|
+
return this.client.get(`/environments/${environmentId}/git/branches`, path ? { path } : undefined);
|
|
100
|
+
}
|
|
101
|
+
async listCommits(environmentId, params = {}) {
|
|
102
|
+
return this.client.get(`/environments/${environmentId}/git/commits`, params);
|
|
103
|
+
}
|
|
104
|
+
async prepareGithub(environmentId, params) {
|
|
105
|
+
return this.client.post(`/environments/${environmentId}/github/prepare`, params);
|
|
106
|
+
}
|
|
107
|
+
async clone(environmentId, params) {
|
|
108
|
+
return this.client.post(`/environments/${environmentId}/git/clone`, params);
|
|
35
109
|
}
|
|
36
110
|
/**
|
|
37
|
-
*
|
|
111
|
+
* Commit diffs are no longer exposed as a standalone public ACP route.
|
|
112
|
+
* Use thread steps, thread diffs, or environment snapshot diffs instead.
|
|
38
113
|
*/
|
|
39
114
|
async getCommitDiff(workspaceId, commitSha) {
|
|
40
|
-
|
|
41
|
-
|
|
115
|
+
void workspaceId;
|
|
116
|
+
void commitSha;
|
|
117
|
+
throw new Error('getCommitDiff() is not available in the current ACP public API. Use thread step diffs or computer snapshot diffs instead.');
|
|
42
118
|
}
|
|
43
119
|
}
|
|
44
120
|
exports.GitResource = GitResource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitResource.js","sourceRoot":"","sources":["../../../src/cloud/resources/GitResource.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"GitResource.js","sourceRoot":"","sources":["../../../src/cloud/resources/GitResource.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA0BH,MAAa,WAAW;IACO;IAA7B,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAElD;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,WAAmB;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACjD,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC;QACxC,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAC1B,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;gBAC7B,SAAS,EAAE,CAAC;gBACZ,SAAS,EAAE,CAAC;gBACZ,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC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I,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,aAAa,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACrG,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,aAAqB,EAAE,SAA4C,EAAE;QACrF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,aAAa,cAAc,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,aAAqB,EAAE,MAAiD;QAC1F,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,aAAa,iBAAiB,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC;IAED,KAAK,CAAC,KAAK,CACT,aAAqB,EACrB,MAAwF;QAExF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,aAAa,YAAY,EAAE,MAAM,CAAC,CAAC;IAC9E,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,aAAa,CAAC,WAAmB,EAAE,SAAiB;QACxD,KAAK,WAAW,CAAC;QACjB,KAAK,SAAS,CAAC;QACf,MAAM,IAAI,KAAK,CACb,2HAA2H,CAC5H,CAAC;IACJ,CAAC;CACF;AA9ID,kCA8IC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ApiClient } from '../ApiClient';
|
|
2
|
+
import type { CreateResourceParams, Resource, ResourceAnalyticsResponse, ResourceBinding, ResourceLogEntry, UpdateResourceParams } from '../types';
|
|
3
|
+
export interface ListResourcesParams {
|
|
4
|
+
projectId?: string;
|
|
5
|
+
limit?: number;
|
|
6
|
+
offset?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ResourceInvokeParams {
|
|
9
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
10
|
+
path?: string;
|
|
11
|
+
body?: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface ResourceAuthUserCreateParams {
|
|
14
|
+
email: string;
|
|
15
|
+
password: string;
|
|
16
|
+
displayName?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ResourceAuthSignInParams {
|
|
19
|
+
email: string;
|
|
20
|
+
password: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ResourceFileEntry {
|
|
23
|
+
name?: string;
|
|
24
|
+
path: string;
|
|
25
|
+
type?: 'file' | 'directory' | string;
|
|
26
|
+
size?: number;
|
|
27
|
+
mimeType?: string;
|
|
28
|
+
modifiedAt?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ResourceFileUploadParams {
|
|
31
|
+
serverId: string;
|
|
32
|
+
filename: string;
|
|
33
|
+
content: string | Buffer;
|
|
34
|
+
path?: string;
|
|
35
|
+
contentType?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare class ResourcesResource {
|
|
38
|
+
private readonly client;
|
|
39
|
+
constructor(client: ApiClient);
|
|
40
|
+
create(params: CreateResourceParams): Promise<Resource>;
|
|
41
|
+
list(params?: ListResourcesParams): Promise<Resource[]>;
|
|
42
|
+
get(serverId: string): Promise<Resource>;
|
|
43
|
+
update(serverId: string, params: UpdateResourceParams): Promise<Resource>;
|
|
44
|
+
delete(serverId: string): Promise<boolean>;
|
|
45
|
+
deploy(serverId: string): Promise<{
|
|
46
|
+
server?: Resource;
|
|
47
|
+
serviceUrl?: string | null;
|
|
48
|
+
invocationUrl?: string | null;
|
|
49
|
+
revision?: string | null;
|
|
50
|
+
deploymentType?: string | null;
|
|
51
|
+
}>;
|
|
52
|
+
invoke(serverId: string, params?: ResourceInvokeParams): Promise<{
|
|
53
|
+
status?: number;
|
|
54
|
+
ok?: boolean;
|
|
55
|
+
url?: string;
|
|
56
|
+
body?: unknown;
|
|
57
|
+
text?: string;
|
|
58
|
+
headers?: Record<string, string>;
|
|
59
|
+
}>;
|
|
60
|
+
createAiChatAppTemplate(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
61
|
+
getAnalytics(serverId: string): Promise<ResourceAnalyticsResponse>;
|
|
62
|
+
getLogs(serverId: string, params?: {
|
|
63
|
+
kind?: 'request' | 'runtime' | 'deployment';
|
|
64
|
+
limit?: number;
|
|
65
|
+
}): Promise<ResourceLogEntry[]>;
|
|
66
|
+
listBindings(serverId: string): Promise<ResourceBinding[]>;
|
|
67
|
+
upsertBinding(serverId: string, targetType: 'database' | 'auth' | 'agent_runtime', params: {
|
|
68
|
+
targetId: string;
|
|
69
|
+
alias?: string;
|
|
70
|
+
metadata?: Record<string, unknown> | null;
|
|
71
|
+
}): Promise<ResourceBinding[]>;
|
|
72
|
+
deleteBinding(serverId: string, targetType: 'database' | 'auth' | 'agent_runtime'): Promise<ResourceBinding[]>;
|
|
73
|
+
listAuthUsers(serverId: string, params?: {
|
|
74
|
+
limit?: number;
|
|
75
|
+
nextPageToken?: string;
|
|
76
|
+
}): Promise<Array<Record<string, unknown>>>;
|
|
77
|
+
createAuthUser(serverId: string, params: ResourceAuthUserCreateParams): Promise<Record<string, unknown>>;
|
|
78
|
+
signUp(serverId: string, params: ResourceAuthUserCreateParams): Promise<Record<string, unknown>>;
|
|
79
|
+
signIn(serverId: string, params: ResourceAuthSignInParams): Promise<Record<string, unknown>>;
|
|
80
|
+
getContext(serverId: string): Promise<Record<string, unknown>>;
|
|
81
|
+
getRuntimeConfig(serverId: string): Promise<Record<string, unknown>>;
|
|
82
|
+
getRuntime(serverId: string): Promise<Record<string, unknown>>;
|
|
83
|
+
listFiles(serverId: string, params?: {
|
|
84
|
+
path?: string;
|
|
85
|
+
depth?: number;
|
|
86
|
+
}): Promise<ResourceFileEntry[]>;
|
|
87
|
+
getFileContent(serverId: string, filePath: string): Promise<string>;
|
|
88
|
+
writeFileContent(serverId: string, filePath: string, content: string): Promise<Record<string, unknown>>;
|
|
89
|
+
downloadFile(serverId: string, filePath: string): Promise<Buffer>;
|
|
90
|
+
uploadFile(params: ResourceFileUploadParams): Promise<Record<string, unknown>>;
|
|
91
|
+
deleteFile(serverId: string, filePath: string): Promise<Record<string, unknown>>;
|
|
92
|
+
}
|