computer-agents 0.7.1 → 1.0.1
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 +170 -399
- package/dist/ComputerAgentsClient.d.ts +357 -0
- package/dist/ComputerAgentsClient.js +359 -0
- package/dist/ComputerAgentsClient.js.map +1 -0
- package/dist/cloud/ApiClient.d.ts +62 -0
- package/dist/cloud/ApiClient.js +150 -0
- package/dist/cloud/ApiClient.js.map +1 -0
- package/dist/cloud/resources/AgentsResource.d.ts +39 -0
- package/dist/cloud/resources/AgentsResource.js +58 -0
- package/dist/cloud/resources/AgentsResource.js.map +1 -0
- package/dist/cloud/resources/BudgetResource.d.ts +167 -0
- package/dist/cloud/resources/BudgetResource.js +179 -0
- package/dist/cloud/resources/BudgetResource.js.map +1 -0
- package/dist/cloud/resources/EnvironmentsResource.d.ts +78 -0
- package/dist/cloud/resources/EnvironmentsResource.js +118 -0
- package/dist/cloud/resources/EnvironmentsResource.js.map +1 -0
- package/dist/cloud/resources/FilesResource.d.ts +177 -0
- package/dist/cloud/resources/FilesResource.js +180 -0
- package/dist/cloud/resources/FilesResource.js.map +1 -0
- package/dist/cloud/resources/GitResource.d.ts +28 -0
- package/dist/cloud/resources/GitResource.js +45 -0
- package/dist/cloud/resources/GitResource.js.map +1 -0
- package/dist/cloud/resources/ProjectsResource.d.ts +78 -0
- package/dist/cloud/resources/ProjectsResource.js +117 -0
- package/dist/cloud/resources/ProjectsResource.js.map +1 -0
- package/dist/cloud/resources/RunsResource.d.ts +61 -0
- package/dist/cloud/resources/RunsResource.js +84 -0
- package/dist/cloud/resources/RunsResource.js.map +1 -0
- package/dist/cloud/resources/SchedulesResource.d.ts +58 -0
- package/dist/cloud/resources/SchedulesResource.js +82 -0
- package/dist/cloud/resources/SchedulesResource.js.map +1 -0
- package/dist/cloud/resources/ThreadsResource.d.ts +124 -0
- package/dist/cloud/resources/ThreadsResource.js +178 -0
- package/dist/cloud/resources/ThreadsResource.js.map +1 -0
- package/dist/cloud/resources/index.d.ts +16 -0
- package/dist/cloud/resources/index.js +28 -0
- package/dist/cloud/resources/index.js.map +1 -0
- package/dist/cloud/types.d.ts +573 -0
- package/dist/cloud/types.js +9 -0
- package/dist/cloud/types.js.map +1 -0
- package/dist/index.d.ts +28 -5
- package/dist/index.js +51 -194
- package/dist/index.js.map +1 -1
- package/package.json +23 -25
- package/dist/metadata.d.ts +0 -8
- package/dist/metadata.js +0 -13
- package/dist/metadata.js.map +0 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projects Resource Manager
|
|
3
|
+
*
|
|
4
|
+
* Handles project-related API operations including file management.
|
|
5
|
+
*
|
|
6
|
+
* Note: With the simplified API, each API key is bound to exactly one project.
|
|
7
|
+
* The project is determined automatically from the API key, so no projectId
|
|
8
|
+
* parameter is needed in method calls.
|
|
9
|
+
*/
|
|
10
|
+
import type { ApiClient } from '../ApiClient';
|
|
11
|
+
import type { Project, UpdateProjectParams, ProjectStats, FileEntry, ListFilesParams, UploadFileParams, CreateDirectoryParams } from '../types';
|
|
12
|
+
export declare class ProjectsResource {
|
|
13
|
+
private readonly client;
|
|
14
|
+
constructor(client: ApiClient);
|
|
15
|
+
/**
|
|
16
|
+
* Get the current project (bound to this API key)
|
|
17
|
+
*
|
|
18
|
+
* Project is determined automatically from the API key.
|
|
19
|
+
*/
|
|
20
|
+
get(): Promise<Project & {
|
|
21
|
+
stats?: ProjectStats;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Update the current project
|
|
25
|
+
*
|
|
26
|
+
* Project is determined automatically from the API key.
|
|
27
|
+
*/
|
|
28
|
+
update(params: UpdateProjectParams): Promise<Project>;
|
|
29
|
+
/**
|
|
30
|
+
* Sync project with cloud storage
|
|
31
|
+
*
|
|
32
|
+
* Project is determined automatically from the API key.
|
|
33
|
+
*/
|
|
34
|
+
sync(changes?: {
|
|
35
|
+
added?: string[];
|
|
36
|
+
modified?: string[];
|
|
37
|
+
deleted?: string[];
|
|
38
|
+
}): Promise<{
|
|
39
|
+
synced: boolean;
|
|
40
|
+
fileCount: number;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* List files in the project
|
|
44
|
+
*
|
|
45
|
+
* Project is determined automatically from the API key.
|
|
46
|
+
*/
|
|
47
|
+
listFiles(params?: ListFilesParams): Promise<FileEntry[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Get a file's content
|
|
50
|
+
*
|
|
51
|
+
* Project is determined automatically from the API key.
|
|
52
|
+
*/
|
|
53
|
+
getFile(filePath: string, environmentId?: string): Promise<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Upload a file
|
|
56
|
+
*
|
|
57
|
+
* Project is determined automatically from the API key.
|
|
58
|
+
*/
|
|
59
|
+
uploadFile(params: UploadFileParams): Promise<FileEntry>;
|
|
60
|
+
/**
|
|
61
|
+
* Delete a file or directory
|
|
62
|
+
*
|
|
63
|
+
* Project is determined automatically from the API key.
|
|
64
|
+
*/
|
|
65
|
+
deleteFile(filePath: string, recursive?: boolean): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Move or rename a file
|
|
68
|
+
*
|
|
69
|
+
* Project is determined automatically from the API key.
|
|
70
|
+
*/
|
|
71
|
+
moveFile(sourcePath: string, destinationPath: string): Promise<FileEntry>;
|
|
72
|
+
/**
|
|
73
|
+
* Create a directory
|
|
74
|
+
*
|
|
75
|
+
* Project is determined automatically from the API key.
|
|
76
|
+
*/
|
|
77
|
+
createDirectory(params: CreateDirectoryParams): Promise<FileEntry>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Projects Resource Manager
|
|
4
|
+
*
|
|
5
|
+
* Handles project-related API operations including file management.
|
|
6
|
+
*
|
|
7
|
+
* Note: With the simplified API, each API key is bound to exactly one project.
|
|
8
|
+
* The project is determined automatically from the API key, so no projectId
|
|
9
|
+
* parameter is needed in method calls.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ProjectsResource = void 0;
|
|
13
|
+
class ProjectsResource {
|
|
14
|
+
client;
|
|
15
|
+
constructor(client) {
|
|
16
|
+
this.client = client;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get the current project (bound to this API key)
|
|
20
|
+
*
|
|
21
|
+
* Project is determined automatically from the API key.
|
|
22
|
+
*/
|
|
23
|
+
async get() {
|
|
24
|
+
const response = await this.client.get(`/project`);
|
|
25
|
+
return response.project;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Update the current project
|
|
29
|
+
*
|
|
30
|
+
* Project is determined automatically from the API key.
|
|
31
|
+
*/
|
|
32
|
+
async update(params) {
|
|
33
|
+
const response = await this.client.patch(`/project`, params);
|
|
34
|
+
return response.project;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Sync project with cloud storage
|
|
38
|
+
*
|
|
39
|
+
* Project is determined automatically from the API key.
|
|
40
|
+
*/
|
|
41
|
+
async sync(changes) {
|
|
42
|
+
const response = await this.client.post(`/project/sync`, { changes });
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
// =========================================================================
|
|
46
|
+
// File Operations
|
|
47
|
+
// =========================================================================
|
|
48
|
+
/**
|
|
49
|
+
* List files in the project
|
|
50
|
+
*
|
|
51
|
+
* Project is determined automatically from the API key.
|
|
52
|
+
*/
|
|
53
|
+
async listFiles(params = {}) {
|
|
54
|
+
const response = await this.client.get(`/files`, {
|
|
55
|
+
path: params.path,
|
|
56
|
+
environmentId: params.environmentId,
|
|
57
|
+
recursive: params.recursive,
|
|
58
|
+
});
|
|
59
|
+
return response.files;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get a file's content
|
|
63
|
+
*
|
|
64
|
+
* Project is determined automatically from the API key.
|
|
65
|
+
*/
|
|
66
|
+
async getFile(filePath, environmentId) {
|
|
67
|
+
const encodedPath = encodeURIComponent(filePath);
|
|
68
|
+
const response = await this.client.get(`/files/${encodedPath}`, { environmentId });
|
|
69
|
+
return response;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Upload a file
|
|
73
|
+
*
|
|
74
|
+
* Project is determined automatically from the API key.
|
|
75
|
+
*/
|
|
76
|
+
async uploadFile(params) {
|
|
77
|
+
// For single file upload, we use the PUT endpoint
|
|
78
|
+
const encodedPath = encodeURIComponent(params.path);
|
|
79
|
+
const response = await this.client.put(`/files/${encodedPath}`, {
|
|
80
|
+
content: typeof params.content === 'string'
|
|
81
|
+
? params.content
|
|
82
|
+
: params.content.toString('base64'),
|
|
83
|
+
contentType: params.contentType,
|
|
84
|
+
environmentId: params.environmentId,
|
|
85
|
+
});
|
|
86
|
+
return response.file;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Delete a file or directory
|
|
90
|
+
*
|
|
91
|
+
* Project is determined automatically from the API key.
|
|
92
|
+
*/
|
|
93
|
+
async deleteFile(filePath, recursive = false) {
|
|
94
|
+
const encodedPath = encodeURIComponent(filePath);
|
|
95
|
+
await this.client.delete(`/files/${encodedPath}${recursive ? '?recursive=true' : ''}`);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Move or rename a file
|
|
99
|
+
*
|
|
100
|
+
* Project is determined automatically from the API key.
|
|
101
|
+
*/
|
|
102
|
+
async moveFile(sourcePath, destinationPath) {
|
|
103
|
+
const response = await this.client.post(`/files/move`, { source: sourcePath, destination: destinationPath });
|
|
104
|
+
return response.file;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Create a directory
|
|
108
|
+
*
|
|
109
|
+
* Project is determined automatically from the API key.
|
|
110
|
+
*/
|
|
111
|
+
async createDirectory(params) {
|
|
112
|
+
const response = await this.client.post(`/directories`, params);
|
|
113
|
+
return response.directory;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.ProjectsResource = ProjectsResource;
|
|
117
|
+
//# sourceMappingURL=ProjectsResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectsResource.js","sourceRoot":"","sources":["../../../src/cloud/resources/ProjectsResource.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAaH,MAAa,gBAAgB;IACE;IAA7B,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAElD;;;;OAIG;IACH,KAAK,CAAC,GAAG;QACP,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACpC,UAAU,CACX,CAAC;QACF,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,MAA2B;QACtC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACtC,UAAU,EACV,MAAM,CACP,CAAC;QACF,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,CACR,OAIC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACrC,eAAe,EACf,EAAE,OAAO,EAAE,CACZ,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,4EAA4E;IAC5E,kBAAkB;IAClB,4EAA4E;IAE5E;;;;OAIG;IACH,KAAK,CAAC,SAAS,CAAC,SAA0B,EAAE;QAC1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACpC,QAAQ,EACR;YACE,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B,CACF,CAAC;QACF,OAAO,QAAQ,CAAC,KAAK,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAC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AAe,EAAE,CACrD,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,eAAe,CACnB,MAA6B;QAE7B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACrC,cAAc,EACd,MAAM,CACP,CAAC;QACF,OAAO,QAAQ,CAAC,SAAS,CAAC;IAC5B,CAAC;CACF;AAzJD,4CAyJC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs Resource Manager
|
|
3
|
+
*
|
|
4
|
+
* Handles execution tracking including CRUD operations,
|
|
5
|
+
* logs retrieval, and file diffs.
|
|
6
|
+
*
|
|
7
|
+
* Note: projectId is now embedded in the API key, so routes use
|
|
8
|
+
* simplified paths without /projects/:projectId prefix.
|
|
9
|
+
*/
|
|
10
|
+
import type { ApiClient } from '../ApiClient';
|
|
11
|
+
import type { Run, CreateRunParams, UpdateRunParams, ListRunsParams, RunLogEntry, RunDiff } from '../types';
|
|
12
|
+
export declare class RunsResource {
|
|
13
|
+
private readonly client;
|
|
14
|
+
constructor(client: ApiClient);
|
|
15
|
+
/**
|
|
16
|
+
* Create a new run
|
|
17
|
+
*
|
|
18
|
+
* Project is determined automatically from the API key.
|
|
19
|
+
*/
|
|
20
|
+
create(params: CreateRunParams): Promise<Run>;
|
|
21
|
+
/**
|
|
22
|
+
* List runs
|
|
23
|
+
*
|
|
24
|
+
* Project is determined automatically from the API key.
|
|
25
|
+
*/
|
|
26
|
+
list(params?: ListRunsParams): Promise<{
|
|
27
|
+
runs: Run[];
|
|
28
|
+
pagination: {
|
|
29
|
+
total: number;
|
|
30
|
+
limit: number;
|
|
31
|
+
offset: number;
|
|
32
|
+
};
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Get a run by ID
|
|
36
|
+
*/
|
|
37
|
+
get(runId: string): Promise<Run>;
|
|
38
|
+
/**
|
|
39
|
+
* Update a run
|
|
40
|
+
*/
|
|
41
|
+
update(runId: string, params: UpdateRunParams): Promise<Run>;
|
|
42
|
+
/**
|
|
43
|
+
* Delete a run
|
|
44
|
+
*/
|
|
45
|
+
delete(runId: string): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Get logs for a run
|
|
48
|
+
*/
|
|
49
|
+
getLogs(runId: string, options?: {
|
|
50
|
+
level?: 'all' | 'info' | 'error';
|
|
51
|
+
format?: 'json' | 'text';
|
|
52
|
+
}): Promise<RunLogEntry[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Append a log entry to a run
|
|
55
|
+
*/
|
|
56
|
+
appendLog(runId: string, entry: Omit<RunLogEntry, 'timestamp'>): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Get file diffs for a run
|
|
59
|
+
*/
|
|
60
|
+
getDiffs(runId: string): Promise<RunDiff[]>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Runs Resource Manager
|
|
4
|
+
*
|
|
5
|
+
* Handles execution tracking including CRUD operations,
|
|
6
|
+
* logs retrieval, and file diffs.
|
|
7
|
+
*
|
|
8
|
+
* Note: projectId is now embedded in the API key, so routes use
|
|
9
|
+
* simplified paths without /projects/:projectId prefix.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RunsResource = void 0;
|
|
13
|
+
class RunsResource {
|
|
14
|
+
client;
|
|
15
|
+
constructor(client) {
|
|
16
|
+
this.client = client;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a new run
|
|
20
|
+
*
|
|
21
|
+
* Project is determined automatically from the API key.
|
|
22
|
+
*/
|
|
23
|
+
async create(params) {
|
|
24
|
+
const response = await this.client.post(`/runs`, params);
|
|
25
|
+
return response.run;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* List runs
|
|
29
|
+
*
|
|
30
|
+
* Project is determined automatically from the API key.
|
|
31
|
+
*/
|
|
32
|
+
async list(params = {}) {
|
|
33
|
+
const response = await this.client.get(`/runs`, {
|
|
34
|
+
limit: params.limit,
|
|
35
|
+
offset: params.offset,
|
|
36
|
+
threadId: params.threadId,
|
|
37
|
+
status: params.status,
|
|
38
|
+
since: params.since,
|
|
39
|
+
});
|
|
40
|
+
return response;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get a run by ID
|
|
44
|
+
*/
|
|
45
|
+
async get(runId) {
|
|
46
|
+
const response = await this.client.get(`/runs/${runId}`);
|
|
47
|
+
return response.run;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Update a run
|
|
51
|
+
*/
|
|
52
|
+
async update(runId, params) {
|
|
53
|
+
const response = await this.client.patch(`/runs/${runId}`, params);
|
|
54
|
+
return response.run;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Delete a run
|
|
58
|
+
*/
|
|
59
|
+
async delete(runId) {
|
|
60
|
+
await this.client.delete(`/runs/${runId}`);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get logs for a run
|
|
64
|
+
*/
|
|
65
|
+
async getLogs(runId, options) {
|
|
66
|
+
const response = await this.client.get(`/runs/${runId}/logs`, options);
|
|
67
|
+
return response.logs;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Append a log entry to a run
|
|
71
|
+
*/
|
|
72
|
+
async appendLog(runId, entry) {
|
|
73
|
+
await this.client.post(`/runs/${runId}/logs`, entry);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get file diffs for a run
|
|
77
|
+
*/
|
|
78
|
+
async getDiffs(runId) {
|
|
79
|
+
const response = await this.client.get(`/threads/${runId}/diffs`);
|
|
80
|
+
return response.diffs;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.RunsResource = RunsResource;
|
|
84
|
+
//# sourceMappingURL=RunsResource.js.map
|
|
@@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,KAAa;QACxB,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CACX,KAAa,EACb,OAAwE;QAExE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACpC,SAAS,KAAK,OAAO,EACrB,OAAO,CACR,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CACb,KAAa,EACb,KAAqC;QAErC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,KAAa;QAC1B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACpC,YAAY,KAAK,QAAQ,CAC1B,CAAC;QACF,OAAO,QAAQ,CAAC,KAAK,CAAC;IACxB,CAAC;CACF;AAtGD,oCAsGC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schedules Resource Manager
|
|
3
|
+
*
|
|
4
|
+
* Handles scheduled task management including CRUD operations
|
|
5
|
+
* and schedule control (trigger/enable/disable).
|
|
6
|
+
*
|
|
7
|
+
* Note: projectId is now embedded in the API key, so routes use
|
|
8
|
+
* simplified paths without /projects/:projectId prefix.
|
|
9
|
+
*/
|
|
10
|
+
import type { ApiClient } from '../ApiClient';
|
|
11
|
+
import type { Schedule, CreateScheduleParams, UpdateScheduleParams } from '../types';
|
|
12
|
+
export declare class SchedulesResource {
|
|
13
|
+
private readonly client;
|
|
14
|
+
constructor(client: ApiClient);
|
|
15
|
+
/**
|
|
16
|
+
* Create a new schedule
|
|
17
|
+
*
|
|
18
|
+
* Project is determined automatically from the API key.
|
|
19
|
+
*/
|
|
20
|
+
create(params: CreateScheduleParams): Promise<Schedule>;
|
|
21
|
+
/**
|
|
22
|
+
* List all schedules
|
|
23
|
+
*
|
|
24
|
+
* Project is determined automatically from the API key.
|
|
25
|
+
*/
|
|
26
|
+
list(params?: {
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
limit?: number;
|
|
29
|
+
offset?: number;
|
|
30
|
+
}): Promise<Schedule[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Get a schedule by ID
|
|
33
|
+
*/
|
|
34
|
+
get(scheduleId: string): Promise<Schedule>;
|
|
35
|
+
/**
|
|
36
|
+
* Update a schedule
|
|
37
|
+
*/
|
|
38
|
+
update(scheduleId: string, params: UpdateScheduleParams): Promise<Schedule>;
|
|
39
|
+
/**
|
|
40
|
+
* Delete a schedule
|
|
41
|
+
*/
|
|
42
|
+
delete(scheduleId: string): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Manually trigger a schedule
|
|
45
|
+
*/
|
|
46
|
+
trigger(scheduleId: string): Promise<{
|
|
47
|
+
runId: string;
|
|
48
|
+
triggered: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Enable a schedule
|
|
52
|
+
*/
|
|
53
|
+
enable(scheduleId: string): Promise<Schedule>;
|
|
54
|
+
/**
|
|
55
|
+
* Disable a schedule
|
|
56
|
+
*/
|
|
57
|
+
disable(scheduleId: string): Promise<Schedule>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Schedules Resource Manager
|
|
4
|
+
*
|
|
5
|
+
* Handles scheduled task management including CRUD operations
|
|
6
|
+
* and schedule control (trigger/enable/disable).
|
|
7
|
+
*
|
|
8
|
+
* Note: projectId is now embedded in the API key, so routes use
|
|
9
|
+
* simplified paths without /projects/:projectId prefix.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SchedulesResource = void 0;
|
|
13
|
+
class SchedulesResource {
|
|
14
|
+
client;
|
|
15
|
+
constructor(client) {
|
|
16
|
+
this.client = client;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a new schedule
|
|
20
|
+
*
|
|
21
|
+
* Project is determined automatically from the API key.
|
|
22
|
+
*/
|
|
23
|
+
async create(params) {
|
|
24
|
+
const response = await this.client.post(`/schedules`, params);
|
|
25
|
+
return response.schedule;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* List all schedules
|
|
29
|
+
*
|
|
30
|
+
* Project is determined automatically from the API key.
|
|
31
|
+
*/
|
|
32
|
+
async list(params) {
|
|
33
|
+
const response = await this.client.get(`/schedules`, params);
|
|
34
|
+
return response.data;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get a schedule by ID
|
|
38
|
+
*/
|
|
39
|
+
async get(scheduleId) {
|
|
40
|
+
const response = await this.client.get(`/schedules/${scheduleId}`);
|
|
41
|
+
return response.schedule;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Update a schedule
|
|
45
|
+
*/
|
|
46
|
+
async update(scheduleId, params) {
|
|
47
|
+
const response = await this.client.patch(`/schedules/${scheduleId}`, params);
|
|
48
|
+
return response.schedule;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Delete a schedule
|
|
52
|
+
*/
|
|
53
|
+
async delete(scheduleId) {
|
|
54
|
+
await this.client.delete(`/schedules/${scheduleId}`);
|
|
55
|
+
}
|
|
56
|
+
// =========================================================================
|
|
57
|
+
// Schedule Control
|
|
58
|
+
// =========================================================================
|
|
59
|
+
/**
|
|
60
|
+
* Manually trigger a schedule
|
|
61
|
+
*/
|
|
62
|
+
async trigger(scheduleId) {
|
|
63
|
+
const response = await this.client.post(`/schedules/${scheduleId}/trigger`);
|
|
64
|
+
return response;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Enable a schedule
|
|
68
|
+
*/
|
|
69
|
+
async enable(scheduleId) {
|
|
70
|
+
const response = await this.client.patch(`/schedules/${scheduleId}/enable`);
|
|
71
|
+
return response.schedule;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Disable a schedule
|
|
75
|
+
*/
|
|
76
|
+
async disable(scheduleId) {
|
|
77
|
+
const response = await this.client.patch(`/schedules/${scheduleId}/disable`);
|
|
78
|
+
return response.schedule;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.SchedulesResource = SchedulesResource;
|
|
82
|
+
//# sourceMappingURL=SchedulesResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchedulesResource.js","sourceRoot":"","sources":["../../../src/cloud/resources/SchedulesResource.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AASH,MAAa,iBAAiB;IACC;IAA7B,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAElD;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,MAA4B;QACvC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACrC,YAAY,EACZ,MAAM,CACP,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,CACR,MAA+D;QAE/D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAKnC,YAAY,EAAE,MAAM,CAAC,CAAC;QACzB,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,UAAkB;QAC1B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACpC,cAAc,UAAU,EAAE,CAC3B,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,UAAkB,EAClB,MAA4B;QAE5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACtC,cAAc,UAAU,EAAE,EAC1B,MAAM,CACP,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,UAAU,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,4EAA4E;IAC5E,mBAAmB;IACnB,4EAA4E;IAE5E;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,UAAkB;QAI9B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAGpC,cAAc,UAAU,UAAU,CAAC,CAAC;QACvC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACtC,cAAc,UAAU,SAAS,CAClC,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,UAAkB;QAC9B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACtC,cAAc,UAAU,UAAU,CACnC,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;CACF;AArGD,8CAqGC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Threads Resource Manager
|
|
3
|
+
*
|
|
4
|
+
* Handles conversation threads including CRUD operations,
|
|
5
|
+
* message execution with SSE streaming, and conversation history.
|
|
6
|
+
*
|
|
7
|
+
* Note: projectId is now embedded in the API key, so routes use
|
|
8
|
+
* simplified paths without /projects/:projectId prefix.
|
|
9
|
+
*/
|
|
10
|
+
import type { ApiClient } from '../ApiClient';
|
|
11
|
+
import type { Thread, CreateThreadParams, UpdateThreadParams, ListThreadsParams, SendMessageParams, ThreadMessage, MessageStreamEvent } from '../types';
|
|
12
|
+
/**
|
|
13
|
+
* Callback for handling streaming events
|
|
14
|
+
*/
|
|
15
|
+
export type StreamEventCallback = (event: MessageStreamEvent) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Options for sendMessage
|
|
18
|
+
*/
|
|
19
|
+
export interface SendMessageOptions extends SendMessageParams {
|
|
20
|
+
/**
|
|
21
|
+
* Callback for handling streaming events
|
|
22
|
+
*/
|
|
23
|
+
onEvent?: StreamEventCallback;
|
|
24
|
+
/**
|
|
25
|
+
* Timeout for the entire streaming operation
|
|
26
|
+
* @default 600000 (10 minutes)
|
|
27
|
+
*/
|
|
28
|
+
timeout?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Result from sendMessage
|
|
32
|
+
*/
|
|
33
|
+
export interface SendMessageResult {
|
|
34
|
+
/**
|
|
35
|
+
* The final response content
|
|
36
|
+
*/
|
|
37
|
+
content: string;
|
|
38
|
+
/**
|
|
39
|
+
* Run details if available
|
|
40
|
+
*/
|
|
41
|
+
run?: {
|
|
42
|
+
id: string;
|
|
43
|
+
status: string;
|
|
44
|
+
tokens?: {
|
|
45
|
+
input: number;
|
|
46
|
+
output: number;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* All events received during streaming
|
|
51
|
+
*/
|
|
52
|
+
events: MessageStreamEvent[];
|
|
53
|
+
}
|
|
54
|
+
export declare class ThreadsResource {
|
|
55
|
+
private readonly client;
|
|
56
|
+
constructor(client: ApiClient);
|
|
57
|
+
/**
|
|
58
|
+
* Create a new thread
|
|
59
|
+
*
|
|
60
|
+
* Project is determined automatically from the API key.
|
|
61
|
+
*/
|
|
62
|
+
create(params: CreateThreadParams): Promise<Thread>;
|
|
63
|
+
/**
|
|
64
|
+
* List threads
|
|
65
|
+
*
|
|
66
|
+
* Project is determined automatically from the API key.
|
|
67
|
+
*/
|
|
68
|
+
list(params?: ListThreadsParams): Promise<{
|
|
69
|
+
data: Thread[];
|
|
70
|
+
hasMore: boolean;
|
|
71
|
+
total: number;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Get a thread by ID with full message history
|
|
75
|
+
*/
|
|
76
|
+
get(threadId: string): Promise<Thread>;
|
|
77
|
+
/**
|
|
78
|
+
* Update a thread
|
|
79
|
+
*/
|
|
80
|
+
update(threadId: string, params: UpdateThreadParams): Promise<Thread>;
|
|
81
|
+
/**
|
|
82
|
+
* Delete a thread (soft delete)
|
|
83
|
+
*/
|
|
84
|
+
delete(threadId: string): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Get message history for a thread
|
|
87
|
+
*/
|
|
88
|
+
getMessages(threadId: string): Promise<{
|
|
89
|
+
data: ThreadMessage[];
|
|
90
|
+
hasMore: boolean;
|
|
91
|
+
total: number;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Send a message to a thread and stream the response
|
|
95
|
+
*
|
|
96
|
+
* This method handles SSE streaming from the API and returns
|
|
97
|
+
* the complete result when finished.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const result = await client.threads.sendMessage(
|
|
102
|
+
* 'thread_456',
|
|
103
|
+
* {
|
|
104
|
+
* content: 'Create a REST API with Flask',
|
|
105
|
+
* onEvent: (event) => {
|
|
106
|
+
* if (event.type === 'response.item.completed') {
|
|
107
|
+
* console.log('Item:', event.item);
|
|
108
|
+
* }
|
|
109
|
+
* }
|
|
110
|
+
* }
|
|
111
|
+
* );
|
|
112
|
+
* console.log('Final response:', result.content);
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
sendMessage(threadId: string, options: SendMessageOptions): Promise<SendMessageResult>;
|
|
116
|
+
/**
|
|
117
|
+
* Cancel an in-progress message execution
|
|
118
|
+
*/
|
|
119
|
+
cancel(threadId: string): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Resume a thread (useful after server restart)
|
|
122
|
+
*/
|
|
123
|
+
resume(threadId: string): Promise<Thread>;
|
|
124
|
+
}
|