@acontext/acontext 0.1.0 → 0.1.2
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/agent/base.d.ts +2 -1
- package/dist/agent/disk.d.ts +8 -7
- package/dist/agent/disk.js +16 -7
- package/dist/agent/index.d.ts +2 -0
- package/dist/agent/index.js +2 -0
- package/dist/agent/prompts.d.ts +6 -0
- package/dist/agent/prompts.js +102 -0
- package/dist/agent/sandbox.d.ts +102 -0
- package/dist/agent/sandbox.js +320 -0
- package/dist/agent/skill.d.ts +2 -8
- package/dist/agent/skill.js +26 -24
- package/dist/agent/text-editor.d.ts +44 -0
- package/dist/agent/text-editor.js +213 -0
- package/dist/client-types.d.ts +1 -0
- package/dist/client.d.ts +1 -4
- package/dist/client.js +4 -6
- package/dist/resources/index.d.ts +0 -2
- package/dist/resources/index.js +0 -2
- package/dist/resources/sandboxes.d.ts +18 -1
- package/dist/resources/sandboxes.js +24 -0
- package/dist/resources/sessions.d.ts +1 -17
- package/dist/resources/sessions.js +0 -26
- package/dist/resources/skills.d.ts +14 -1
- package/dist/resources/skills.js +17 -0
- package/dist/resources/users.d.ts +2 -2
- package/dist/resources/users.js +2 -2
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.js +0 -2
- package/dist/types/sandbox.d.ts +47 -0
- package/dist/types/sandbox.js +24 -1
- package/dist/types/session.d.ts +0 -12
- package/dist/types/session.js +1 -8
- package/dist/types/skill.d.ts +7 -0
- package/dist/types/skill.js +7 -1
- package/dist/types/tool.d.ts +0 -4
- package/dist/types/tool.js +1 -4
- package/dist/types/user.d.ts +0 -2
- package/dist/types/user.js +0 -1
- package/package.json +8 -8
- package/dist/resources/blocks.d.ts +0 -33
- package/dist/resources/blocks.js +0 -85
- package/dist/resources/spaces.d.ts +0 -68
- package/dist/resources/spaces.js +0 -109
- package/dist/types/block.d.ts +0 -18
- package/dist/types/block.js +0 -20
- package/dist/types/space.d.ts +0 -67
- package/dist/types/space.js +0 -44
package/dist/client.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* High-level synchronous client for the Acontext API.
|
|
3
3
|
*/
|
|
4
|
-
import { BlocksAPI } from './resources/blocks';
|
|
5
4
|
import { DisksAPI } from './resources/disks';
|
|
6
5
|
import { SandboxesAPI } from './resources/sandboxes';
|
|
7
6
|
import { SessionsAPI } from './resources/sessions';
|
|
8
|
-
import { SpacesAPI } from './resources/spaces';
|
|
9
7
|
import { ToolsAPI } from './resources/tools';
|
|
10
8
|
import { SkillsAPI } from './resources/skills';
|
|
11
9
|
import { UsersAPI } from './resources/users';
|
|
@@ -21,11 +19,9 @@ export declare class AcontextClient implements RequesterProtocol {
|
|
|
21
19
|
private _apiKey;
|
|
22
20
|
private _timeout;
|
|
23
21
|
private _userAgent;
|
|
24
|
-
spaces: SpacesAPI;
|
|
25
22
|
sessions: SessionsAPI;
|
|
26
23
|
disks: DisksAPI;
|
|
27
24
|
artifacts: DisksAPI['artifacts'];
|
|
28
|
-
blocks: BlocksAPI;
|
|
29
25
|
tools: ToolsAPI;
|
|
30
26
|
skills: SkillsAPI;
|
|
31
27
|
users: UsersAPI;
|
|
@@ -50,6 +46,7 @@ export declare class AcontextClient implements RequesterProtocol {
|
|
|
50
46
|
contentType: string;
|
|
51
47
|
}>;
|
|
52
48
|
unwrap?: boolean;
|
|
49
|
+
timeout?: number;
|
|
53
50
|
}): Promise<T>;
|
|
54
51
|
private handleResponse;
|
|
55
52
|
private getFetch;
|
package/dist/client.js
CHANGED
|
@@ -38,11 +38,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.AcontextClient = void 0;
|
|
40
40
|
const errors_1 = require("./errors");
|
|
41
|
-
const blocks_1 = require("./resources/blocks");
|
|
42
41
|
const disks_1 = require("./resources/disks");
|
|
43
42
|
const sandboxes_1 = require("./resources/sandboxes");
|
|
44
43
|
const sessions_1 = require("./resources/sessions");
|
|
45
|
-
const spaces_1 = require("./resources/spaces");
|
|
46
44
|
const tools_1 = require("./resources/tools");
|
|
47
45
|
const skills_1 = require("./resources/skills");
|
|
48
46
|
const users_1 = require("./resources/users");
|
|
@@ -74,11 +72,9 @@ class AcontextClient {
|
|
|
74
72
|
(typeof process !== 'undefined' && process.env?.ACONTEXT_TIMEOUT
|
|
75
73
|
? parseFloat(process.env.ACONTEXT_TIMEOUT)
|
|
76
74
|
: 320000);
|
|
77
|
-
this.spaces = new spaces_1.SpacesAPI(this);
|
|
78
75
|
this.sessions = new sessions_1.SessionsAPI(this);
|
|
79
76
|
this.disks = new disks_1.DisksAPI(this);
|
|
80
77
|
this.artifacts = this.disks.artifacts;
|
|
81
|
-
this.blocks = new blocks_1.BlocksAPI(this);
|
|
82
78
|
this.tools = new tools_1.ToolsAPI(this);
|
|
83
79
|
this.skills = new skills_1.SkillsAPI(this);
|
|
84
80
|
this.users = new users_1.UsersAPI(this);
|
|
@@ -103,6 +99,8 @@ class AcontextClient {
|
|
|
103
99
|
async request(method, path, options) {
|
|
104
100
|
const unwrap = options?.unwrap !== false;
|
|
105
101
|
const url = `${this._baseUrl}${path}`;
|
|
102
|
+
// Use per-request timeout if provided, otherwise use client default
|
|
103
|
+
const effectiveTimeout = options?.timeout ?? this._timeout;
|
|
106
104
|
try {
|
|
107
105
|
// Build headers
|
|
108
106
|
const headers = {
|
|
@@ -188,7 +186,7 @@ class AcontextClient {
|
|
|
188
186
|
// Make the request
|
|
189
187
|
const fetchImpl = await this.getFetch();
|
|
190
188
|
const controller = new AbortController();
|
|
191
|
-
const timeoutId = setTimeout(() => controller.abort(),
|
|
189
|
+
const timeoutId = setTimeout(() => controller.abort(), effectiveTimeout);
|
|
192
190
|
try {
|
|
193
191
|
const response = await fetchImpl(finalUrl, {
|
|
194
192
|
method,
|
|
@@ -202,7 +200,7 @@ class AcontextClient {
|
|
|
202
200
|
catch (error) {
|
|
203
201
|
clearTimeout(timeoutId);
|
|
204
202
|
if (error instanceof Error && error.name === 'AbortError') {
|
|
205
|
-
throw new errors_1.TransportError(`Request timeout after ${
|
|
203
|
+
throw new errors_1.TransportError(`Request timeout after ${effectiveTimeout}ms`);
|
|
206
204
|
}
|
|
207
205
|
throw error;
|
|
208
206
|
}
|
package/dist/resources/index.js
CHANGED
|
@@ -17,10 +17,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
17
17
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
__exportStar(require("./spaces"), exports);
|
|
21
20
|
__exportStar(require("./sessions"), exports);
|
|
22
21
|
__exportStar(require("./disks"), exports);
|
|
23
|
-
__exportStar(require("./blocks"), exports);
|
|
24
22
|
__exportStar(require("./tools"), exports);
|
|
25
23
|
__exportStar(require("./skills"), exports);
|
|
26
24
|
__exportStar(require("./sandboxes"), exports);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Sandboxes endpoints.
|
|
3
3
|
*/
|
|
4
4
|
import { RequesterProtocol } from '../client-types';
|
|
5
|
-
import { FlagResponse, SandboxCommandOutput, SandboxRuntimeInfo } from '../types';
|
|
5
|
+
import { FlagResponse, GetSandboxLogsOutput, SandboxCommandOutput, SandboxRuntimeInfo } from '../types';
|
|
6
6
|
export declare class SandboxesAPI {
|
|
7
7
|
private requester;
|
|
8
8
|
constructor(requester: RequesterProtocol);
|
|
@@ -18,11 +18,14 @@ export declare class SandboxesAPI {
|
|
|
18
18
|
* @param options - Command execution options
|
|
19
19
|
* @param options.sandboxId - The UUID of the sandbox
|
|
20
20
|
* @param options.command - The shell command to execute
|
|
21
|
+
* @param options.timeout - Optional timeout in milliseconds for this command.
|
|
22
|
+
* If not provided, uses the client's default timeout.
|
|
21
23
|
* @returns SandboxCommandOutput containing stdout, stderr, and exit code
|
|
22
24
|
*/
|
|
23
25
|
execCommand(options: {
|
|
24
26
|
sandboxId: string;
|
|
25
27
|
command: string;
|
|
28
|
+
timeout?: number;
|
|
26
29
|
}): Promise<SandboxCommandOutput>;
|
|
27
30
|
/**
|
|
28
31
|
* Kill a running sandbox.
|
|
@@ -31,4 +34,18 @@ export declare class SandboxesAPI {
|
|
|
31
34
|
* @returns FlagResponse with status and error message
|
|
32
35
|
*/
|
|
33
36
|
kill(sandboxId: string): Promise<FlagResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Get sandbox logs for the project with cursor-based pagination.
|
|
39
|
+
*
|
|
40
|
+
* @param options - Optional parameters for retrieving logs
|
|
41
|
+
* @param options.limit - Maximum number of logs to return (default 20, max 200)
|
|
42
|
+
* @param options.cursor - Cursor for pagination. Use the cursor from the previous response to get the next page
|
|
43
|
+
* @param options.timeDesc - Order by created_at descending if true, ascending if false (default false)
|
|
44
|
+
* @returns GetSandboxLogsOutput containing the list of sandbox logs and pagination information
|
|
45
|
+
*/
|
|
46
|
+
getLogs(options?: {
|
|
47
|
+
limit?: number | null;
|
|
48
|
+
cursor?: string | null;
|
|
49
|
+
timeDesc?: boolean | null;
|
|
50
|
+
}): Promise<GetSandboxLogsOutput>;
|
|
34
51
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SandboxesAPI = void 0;
|
|
7
|
+
const utils_1 = require("../utils");
|
|
7
8
|
const types_1 = require("../types");
|
|
8
9
|
class SandboxesAPI {
|
|
9
10
|
constructor(requester) {
|
|
@@ -24,11 +25,14 @@ class SandboxesAPI {
|
|
|
24
25
|
* @param options - Command execution options
|
|
25
26
|
* @param options.sandboxId - The UUID of the sandbox
|
|
26
27
|
* @param options.command - The shell command to execute
|
|
28
|
+
* @param options.timeout - Optional timeout in milliseconds for this command.
|
|
29
|
+
* If not provided, uses the client's default timeout.
|
|
27
30
|
* @returns SandboxCommandOutput containing stdout, stderr, and exit code
|
|
28
31
|
*/
|
|
29
32
|
async execCommand(options) {
|
|
30
33
|
const data = await this.requester.request('POST', `/sandbox/${options.sandboxId}/exec`, {
|
|
31
34
|
jsonData: { command: options.command },
|
|
35
|
+
timeout: options.timeout,
|
|
32
36
|
});
|
|
33
37
|
return types_1.SandboxCommandOutputSchema.parse(data);
|
|
34
38
|
}
|
|
@@ -42,5 +46,25 @@ class SandboxesAPI {
|
|
|
42
46
|
const data = await this.requester.request('DELETE', `/sandbox/${sandboxId}`);
|
|
43
47
|
return types_1.FlagResponseSchema.parse(data);
|
|
44
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Get sandbox logs for the project with cursor-based pagination.
|
|
51
|
+
*
|
|
52
|
+
* @param options - Optional parameters for retrieving logs
|
|
53
|
+
* @param options.limit - Maximum number of logs to return (default 20, max 200)
|
|
54
|
+
* @param options.cursor - Cursor for pagination. Use the cursor from the previous response to get the next page
|
|
55
|
+
* @param options.timeDesc - Order by created_at descending if true, ascending if false (default false)
|
|
56
|
+
* @returns GetSandboxLogsOutput containing the list of sandbox logs and pagination information
|
|
57
|
+
*/
|
|
58
|
+
async getLogs(options) {
|
|
59
|
+
const params = (0, utils_1.buildParams)({
|
|
60
|
+
limit: options?.limit ?? null,
|
|
61
|
+
cursor: options?.cursor ?? null,
|
|
62
|
+
time_desc: options?.timeDesc ?? null,
|
|
63
|
+
});
|
|
64
|
+
const data = await this.requester.request('GET', '/sandbox/logs', {
|
|
65
|
+
params: Object.keys(params).length > 0 ? params : undefined,
|
|
66
|
+
});
|
|
67
|
+
return types_1.GetSandboxLogsOutputSchema.parse(data);
|
|
68
|
+
}
|
|
45
69
|
}
|
|
46
70
|
exports.SandboxesAPI = SandboxesAPI;
|
|
@@ -4,22 +4,19 @@
|
|
|
4
4
|
import { RequesterProtocol } from '../client-types';
|
|
5
5
|
import { AcontextMessage } from '../messages';
|
|
6
6
|
import { FileUpload } from '../uploads';
|
|
7
|
-
import { EditStrategy, GetMessagesOutput, GetTasksOutput,
|
|
7
|
+
import { EditStrategy, GetMessagesOutput, GetTasksOutput, ListSessionsOutput, Message, MessageObservingStatus, Session, TokenCounts } from '../types';
|
|
8
8
|
export type MessageBlob = AcontextMessage | Record<string, unknown>;
|
|
9
9
|
export declare class SessionsAPI {
|
|
10
10
|
private requester;
|
|
11
11
|
constructor(requester: RequesterProtocol);
|
|
12
12
|
list(options?: {
|
|
13
13
|
user?: string | null;
|
|
14
|
-
spaceId?: string | null;
|
|
15
|
-
notConnected?: boolean | null;
|
|
16
14
|
limit?: number | null;
|
|
17
15
|
cursor?: string | null;
|
|
18
16
|
timeDesc?: boolean | null;
|
|
19
17
|
}): Promise<ListSessionsOutput>;
|
|
20
18
|
create(options?: {
|
|
21
19
|
user?: string | null;
|
|
22
|
-
spaceId?: string | null;
|
|
23
20
|
disableTaskTracking?: boolean | null;
|
|
24
21
|
configs?: Record<string, unknown>;
|
|
25
22
|
}): Promise<Session>;
|
|
@@ -28,9 +25,6 @@ export declare class SessionsAPI {
|
|
|
28
25
|
configs: Record<string, unknown>;
|
|
29
26
|
}): Promise<void>;
|
|
30
27
|
getConfigs(sessionId: string): Promise<Session>;
|
|
31
|
-
connectToSpace(sessionId: string, options: {
|
|
32
|
-
spaceId: string;
|
|
33
|
-
}): Promise<void>;
|
|
34
28
|
getTasks(sessionId: string, options?: {
|
|
35
29
|
limit?: number | null;
|
|
36
30
|
cursor?: string | null;
|
|
@@ -87,16 +81,6 @@ export declare class SessionsAPI {
|
|
|
87
81
|
status: number;
|
|
88
82
|
errmsg: string;
|
|
89
83
|
}>;
|
|
90
|
-
/**
|
|
91
|
-
* Get learning status for a session.
|
|
92
|
-
*
|
|
93
|
-
* Returns the count of space digested tasks and not space digested tasks.
|
|
94
|
-
* If the session is not connected to a space, returns 0 and 0.
|
|
95
|
-
*
|
|
96
|
-
* @param sessionId - The UUID of the session.
|
|
97
|
-
* @returns LearningStatus object containing space_digested_count and not_space_digested_count.
|
|
98
|
-
*/
|
|
99
|
-
getLearningStatus(sessionId: string): Promise<LearningStatus>;
|
|
100
84
|
/**
|
|
101
85
|
* Get total token counts for all text and tool-call parts in a session.
|
|
102
86
|
*
|
|
@@ -16,11 +16,7 @@ class SessionsAPI {
|
|
|
16
16
|
if (options?.user) {
|
|
17
17
|
params.user = options.user;
|
|
18
18
|
}
|
|
19
|
-
if (options?.spaceId) {
|
|
20
|
-
params.space_id = options.spaceId;
|
|
21
|
-
}
|
|
22
19
|
Object.assign(params, (0, utils_1.buildParams)({
|
|
23
|
-
not_connected: options?.notConnected ?? null,
|
|
24
20
|
limit: options?.limit ?? null,
|
|
25
21
|
cursor: options?.cursor ?? null,
|
|
26
22
|
time_desc: options?.timeDesc ?? null,
|
|
@@ -35,9 +31,6 @@ class SessionsAPI {
|
|
|
35
31
|
if (options?.user !== undefined && options?.user !== null) {
|
|
36
32
|
payload.user = options.user;
|
|
37
33
|
}
|
|
38
|
-
if (options?.spaceId) {
|
|
39
|
-
payload.space_id = options.spaceId;
|
|
40
|
-
}
|
|
41
34
|
if (options?.disableTaskTracking !== undefined && options?.disableTaskTracking !== null) {
|
|
42
35
|
payload.disable_task_tracking = options.disableTaskTracking;
|
|
43
36
|
}
|
|
@@ -62,12 +55,6 @@ class SessionsAPI {
|
|
|
62
55
|
const data = await this.requester.request('GET', `/session/${sessionId}/configs`);
|
|
63
56
|
return types_1.SessionSchema.parse(data);
|
|
64
57
|
}
|
|
65
|
-
async connectToSpace(sessionId, options) {
|
|
66
|
-
const payload = { space_id: options.spaceId };
|
|
67
|
-
await this.requester.request('POST', `/session/${sessionId}/connect_to_space`, {
|
|
68
|
-
jsonData: payload,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
58
|
async getTasks(sessionId, options) {
|
|
72
59
|
const params = (0, utils_1.buildParams)({
|
|
73
60
|
limit: options?.limit ?? null,
|
|
@@ -213,19 +200,6 @@ class SessionsAPI {
|
|
|
213
200
|
const data = await this.requester.request('POST', `/session/${sessionId}/flush`);
|
|
214
201
|
return data;
|
|
215
202
|
}
|
|
216
|
-
/**
|
|
217
|
-
* Get learning status for a session.
|
|
218
|
-
*
|
|
219
|
-
* Returns the count of space digested tasks and not space digested tasks.
|
|
220
|
-
* If the session is not connected to a space, returns 0 and 0.
|
|
221
|
-
*
|
|
222
|
-
* @param sessionId - The UUID of the session.
|
|
223
|
-
* @returns LearningStatus object containing space_digested_count and not_space_digested_count.
|
|
224
|
-
*/
|
|
225
|
-
async getLearningStatus(sessionId) {
|
|
226
|
-
const data = await this.requester.request('GET', `/session/${sessionId}/get_learning_status`);
|
|
227
|
-
return types_1.LearningStatusSchema.parse(data);
|
|
228
|
-
}
|
|
229
203
|
/**
|
|
230
204
|
* Get total token counts for all text and tool-call parts in a session.
|
|
231
205
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { RequesterProtocol } from '../client-types';
|
|
5
5
|
import { FileUpload } from '../uploads';
|
|
6
|
-
import { GetSkillFileResp, ListSkillsOutput, Skill } from '../types';
|
|
6
|
+
import { DownloadSkillToSandboxResp, GetSkillFileResp, ListSkillsOutput, Skill } from '../types';
|
|
7
7
|
export declare class SkillsAPI {
|
|
8
8
|
private requester;
|
|
9
9
|
constructor(requester: RequesterProtocol);
|
|
@@ -54,4 +54,17 @@ export declare class SkillsAPI {
|
|
|
54
54
|
filePath: string;
|
|
55
55
|
expire?: number | null;
|
|
56
56
|
}): Promise<GetSkillFileResp>;
|
|
57
|
+
/**
|
|
58
|
+
* Download all files from a skill to a sandbox environment.
|
|
59
|
+
*
|
|
60
|
+
* Files are placed at /skills/{skillName}/.
|
|
61
|
+
*
|
|
62
|
+
* @param skillId - The UUID of the skill to download
|
|
63
|
+
* @param options - Download options
|
|
64
|
+
* @param options.sandboxId - The UUID of the target sandbox
|
|
65
|
+
* @returns DownloadSkillToSandboxResp containing success status, directory path, skill name and description
|
|
66
|
+
*/
|
|
67
|
+
downloadToSandbox(skillId: string, options: {
|
|
68
|
+
sandboxId: string;
|
|
69
|
+
}): Promise<DownloadSkillToSandboxResp>;
|
|
57
70
|
}
|
package/dist/resources/skills.js
CHANGED
|
@@ -93,5 +93,22 @@ class SkillsAPI {
|
|
|
93
93
|
});
|
|
94
94
|
return types_1.GetSkillFileRespSchema.parse(data);
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Download all files from a skill to a sandbox environment.
|
|
98
|
+
*
|
|
99
|
+
* Files are placed at /skills/{skillName}/.
|
|
100
|
+
*
|
|
101
|
+
* @param skillId - The UUID of the skill to download
|
|
102
|
+
* @param options - Download options
|
|
103
|
+
* @param options.sandboxId - The UUID of the target sandbox
|
|
104
|
+
* @returns DownloadSkillToSandboxResp containing success status, directory path, skill name and description
|
|
105
|
+
*/
|
|
106
|
+
async downloadToSandbox(skillId, options) {
|
|
107
|
+
const payload = {
|
|
108
|
+
sandbox_id: options.sandboxId,
|
|
109
|
+
};
|
|
110
|
+
const data = await this.requester.request('POST', `/agent_skills/${skillId}/download_to_sandbox`, { jsonData: payload });
|
|
111
|
+
return types_1.DownloadSkillToSandboxRespSchema.parse(data);
|
|
112
|
+
}
|
|
96
113
|
}
|
|
97
114
|
exports.SkillsAPI = SkillsAPI;
|
|
@@ -24,11 +24,11 @@ export declare class UsersAPI {
|
|
|
24
24
|
* Get resource counts for a user.
|
|
25
25
|
*
|
|
26
26
|
* @param identifier - The user identifier string
|
|
27
|
-
* @returns GetUserResourcesOutput containing counts for
|
|
27
|
+
* @returns GetUserResourcesOutput containing counts for Sessions, Disks, and Skills
|
|
28
28
|
*/
|
|
29
29
|
getResources(identifier: string): Promise<GetUserResourcesOutput>;
|
|
30
30
|
/**
|
|
31
|
-
* Delete a user and cascade delete all associated resources (
|
|
31
|
+
* Delete a user and cascade delete all associated resources (Session, Disk, Skill).
|
|
32
32
|
*
|
|
33
33
|
* @param identifier - The user identifier string
|
|
34
34
|
*/
|
package/dist/resources/users.js
CHANGED
|
@@ -34,14 +34,14 @@ class UsersAPI {
|
|
|
34
34
|
* Get resource counts for a user.
|
|
35
35
|
*
|
|
36
36
|
* @param identifier - The user identifier string
|
|
37
|
-
* @returns GetUserResourcesOutput containing counts for
|
|
37
|
+
* @returns GetUserResourcesOutput containing counts for Sessions, Disks, and Skills
|
|
38
38
|
*/
|
|
39
39
|
async getResources(identifier) {
|
|
40
40
|
const data = await this.requester.request('GET', `/user/${encodeURIComponent(identifier)}/resources`);
|
|
41
41
|
return types_1.GetUserResourcesOutputSchema.parse(data);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Delete a user and cascade delete all associated resources (
|
|
44
|
+
* Delete a user and cascade delete all associated resources (Session, Disk, Skill).
|
|
45
45
|
*
|
|
46
46
|
* @param identifier - The user identifier string
|
|
47
47
|
*/
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -18,10 +18,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
__exportStar(require("./common"), exports);
|
|
21
|
-
__exportStar(require("./space"), exports);
|
|
22
21
|
__exportStar(require("./session"), exports);
|
|
23
22
|
__exportStar(require("./disk"), exports);
|
|
24
|
-
__exportStar(require("./block"), exports);
|
|
25
23
|
__exportStar(require("./tool"), exports);
|
|
26
24
|
__exportStar(require("./skill"), exports);
|
|
27
25
|
__exportStar(require("./sandbox"), exports);
|
package/dist/types/sandbox.d.ts
CHANGED
|
@@ -15,3 +15,50 @@ export declare const SandboxCommandOutputSchema: z.ZodObject<{
|
|
|
15
15
|
exit_code: z.ZodNumber;
|
|
16
16
|
}, z.core.$strip>;
|
|
17
17
|
export type SandboxCommandOutput = z.infer<typeof SandboxCommandOutputSchema>;
|
|
18
|
+
export declare const HistoryCommandSchema: z.ZodObject<{
|
|
19
|
+
command: z.ZodString;
|
|
20
|
+
exit_code: z.ZodNumber;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type HistoryCommand = z.infer<typeof HistoryCommandSchema>;
|
|
23
|
+
export declare const GeneratedFileSchema: z.ZodObject<{
|
|
24
|
+
sandbox_path: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type GeneratedFile = z.infer<typeof GeneratedFileSchema>;
|
|
27
|
+
export declare const SandboxLogSchema: z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
project_id: z.ZodString;
|
|
30
|
+
backend_sandbox_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
backend_type: z.ZodString;
|
|
32
|
+
history_commands: z.ZodArray<z.ZodObject<{
|
|
33
|
+
command: z.ZodString;
|
|
34
|
+
exit_code: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
generated_files: z.ZodArray<z.ZodObject<{
|
|
37
|
+
sandbox_path: z.ZodString;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
will_total_alive_seconds: z.ZodNumber;
|
|
40
|
+
created_at: z.ZodString;
|
|
41
|
+
updated_at: z.ZodString;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export type SandboxLog = z.infer<typeof SandboxLogSchema>;
|
|
44
|
+
export declare const GetSandboxLogsOutputSchema: z.ZodObject<{
|
|
45
|
+
items: z.ZodArray<z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
project_id: z.ZodString;
|
|
48
|
+
backend_sandbox_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
backend_type: z.ZodString;
|
|
50
|
+
history_commands: z.ZodArray<z.ZodObject<{
|
|
51
|
+
command: z.ZodString;
|
|
52
|
+
exit_code: z.ZodNumber;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
generated_files: z.ZodArray<z.ZodObject<{
|
|
55
|
+
sandbox_path: z.ZodString;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
will_total_alive_seconds: z.ZodNumber;
|
|
58
|
+
created_at: z.ZodString;
|
|
59
|
+
updated_at: z.ZodString;
|
|
60
|
+
}, z.core.$strip>>;
|
|
61
|
+
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
62
|
+
has_more: z.ZodBoolean;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type GetSandboxLogsOutput = z.infer<typeof GetSandboxLogsOutputSchema>;
|
package/dist/types/sandbox.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Type definitions for sandbox resources.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SandboxCommandOutputSchema = exports.SandboxRuntimeInfoSchema = void 0;
|
|
6
|
+
exports.GetSandboxLogsOutputSchema = exports.SandboxLogSchema = exports.GeneratedFileSchema = exports.HistoryCommandSchema = exports.SandboxCommandOutputSchema = exports.SandboxRuntimeInfoSchema = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
exports.SandboxRuntimeInfoSchema = zod_1.z.object({
|
|
9
9
|
sandbox_id: zod_1.z.string(),
|
|
@@ -16,3 +16,26 @@ exports.SandboxCommandOutputSchema = zod_1.z.object({
|
|
|
16
16
|
stderr: zod_1.z.string(),
|
|
17
17
|
exit_code: zod_1.z.number(),
|
|
18
18
|
});
|
|
19
|
+
exports.HistoryCommandSchema = zod_1.z.object({
|
|
20
|
+
command: zod_1.z.string(),
|
|
21
|
+
exit_code: zod_1.z.number(),
|
|
22
|
+
});
|
|
23
|
+
exports.GeneratedFileSchema = zod_1.z.object({
|
|
24
|
+
sandbox_path: zod_1.z.string(),
|
|
25
|
+
});
|
|
26
|
+
exports.SandboxLogSchema = zod_1.z.object({
|
|
27
|
+
id: zod_1.z.string(),
|
|
28
|
+
project_id: zod_1.z.string(),
|
|
29
|
+
backend_sandbox_id: zod_1.z.string().nullable().optional(),
|
|
30
|
+
backend_type: zod_1.z.string(),
|
|
31
|
+
history_commands: zod_1.z.array(exports.HistoryCommandSchema),
|
|
32
|
+
generated_files: zod_1.z.array(exports.GeneratedFileSchema),
|
|
33
|
+
will_total_alive_seconds: zod_1.z.number(),
|
|
34
|
+
created_at: zod_1.z.string(),
|
|
35
|
+
updated_at: zod_1.z.string(),
|
|
36
|
+
});
|
|
37
|
+
exports.GetSandboxLogsOutputSchema = zod_1.z.object({
|
|
38
|
+
items: zod_1.z.array(exports.SandboxLogSchema),
|
|
39
|
+
next_cursor: zod_1.z.string().nullable().optional(),
|
|
40
|
+
has_more: zod_1.z.boolean(),
|
|
41
|
+
});
|
package/dist/types/session.d.ts
CHANGED
|
@@ -57,7 +57,6 @@ export declare const SessionSchema: z.ZodObject<{
|
|
|
57
57
|
project_id: z.ZodString;
|
|
58
58
|
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
59
|
disable_task_tracking: z.ZodBoolean;
|
|
60
|
-
space_id: z.ZodNullable<z.ZodString>;
|
|
61
60
|
configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
62
61
|
created_at: z.ZodString;
|
|
63
62
|
updated_at: z.ZodString;
|
|
@@ -72,7 +71,6 @@ export declare const TaskDataSchema: z.ZodObject<{
|
|
|
72
71
|
task_description: z.ZodString;
|
|
73
72
|
progresses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
74
73
|
user_preferences: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
75
|
-
sop_thinking: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
74
|
}, z.core.$strip>;
|
|
77
75
|
export type TaskData = z.infer<typeof TaskDataSchema>;
|
|
78
76
|
export declare const TaskSchema: z.ZodObject<{
|
|
@@ -84,11 +82,9 @@ export declare const TaskSchema: z.ZodObject<{
|
|
|
84
82
|
task_description: z.ZodString;
|
|
85
83
|
progresses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
86
84
|
user_preferences: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
87
|
-
sop_thinking: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
88
85
|
}, z.core.$strip>;
|
|
89
86
|
status: z.ZodString;
|
|
90
87
|
is_planning: z.ZodBoolean;
|
|
91
|
-
space_digested: z.ZodBoolean;
|
|
92
88
|
created_at: z.ZodString;
|
|
93
89
|
updated_at: z.ZodString;
|
|
94
90
|
}, z.core.$strip>;
|
|
@@ -99,7 +95,6 @@ export declare const ListSessionsOutputSchema: z.ZodObject<{
|
|
|
99
95
|
project_id: z.ZodString;
|
|
100
96
|
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
101
97
|
disable_task_tracking: z.ZodBoolean;
|
|
102
|
-
space_id: z.ZodNullable<z.ZodString>;
|
|
103
98
|
configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
104
99
|
created_at: z.ZodString;
|
|
105
100
|
updated_at: z.ZodString;
|
|
@@ -136,11 +131,9 @@ export declare const GetTasksOutputSchema: z.ZodObject<{
|
|
|
136
131
|
task_description: z.ZodString;
|
|
137
132
|
progresses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
138
133
|
user_preferences: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
139
|
-
sop_thinking: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
140
134
|
}, z.core.$strip>;
|
|
141
135
|
status: z.ZodString;
|
|
142
136
|
is_planning: z.ZodBoolean;
|
|
143
|
-
space_digested: z.ZodBoolean;
|
|
144
137
|
created_at: z.ZodString;
|
|
145
138
|
updated_at: z.ZodString;
|
|
146
139
|
}, z.core.$strip>>;
|
|
@@ -148,11 +141,6 @@ export declare const GetTasksOutputSchema: z.ZodObject<{
|
|
|
148
141
|
has_more: z.ZodBoolean;
|
|
149
142
|
}, z.core.$strip>;
|
|
150
143
|
export type GetTasksOutput = z.infer<typeof GetTasksOutputSchema>;
|
|
151
|
-
export declare const LearningStatusSchema: z.ZodObject<{
|
|
152
|
-
space_digested_count: z.ZodNumber;
|
|
153
|
-
not_space_digested_count: z.ZodNumber;
|
|
154
|
-
}, z.core.$strip>;
|
|
155
|
-
export type LearningStatus = z.infer<typeof LearningStatusSchema>;
|
|
156
144
|
export declare const TokenCountsSchema: z.ZodObject<{
|
|
157
145
|
total_tokens: z.ZodNumber;
|
|
158
146
|
}, z.core.$strip>;
|
package/dist/types/session.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Type definitions for session, message, and task resources.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EditStrategySchema = exports.MiddleOutStrategySchema = exports.MiddleOutParamsSchema = exports.TokenLimitStrategySchema = exports.TokenLimitParamsSchema = exports.RemoveToolResultStrategySchema = exports.RemoveToolCallParamsStrategySchema = exports.RemoveToolCallParamsParamsSchema = exports.RemoveToolResultParamsSchema = exports.MessageObservingStatusSchema = exports.TokenCountsSchema = exports.
|
|
6
|
+
exports.EditStrategySchema = exports.MiddleOutStrategySchema = exports.MiddleOutParamsSchema = exports.TokenLimitStrategySchema = exports.TokenLimitParamsSchema = exports.RemoveToolResultStrategySchema = exports.RemoveToolCallParamsStrategySchema = exports.RemoveToolCallParamsParamsSchema = exports.RemoveToolResultParamsSchema = exports.MessageObservingStatusSchema = exports.TokenCountsSchema = exports.GetTasksOutputSchema = exports.GetMessagesOutputSchema = exports.PublicURLSchema = exports.ListSessionsOutputSchema = exports.TaskSchema = exports.TaskDataSchema = exports.SessionSchema = exports.MessageSchema = exports.PartSchema = exports.AssetSchema = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
exports.AssetSchema = zod_1.z.object({
|
|
9
9
|
bucket: zod_1.z.string(),
|
|
@@ -37,7 +37,6 @@ exports.SessionSchema = zod_1.z.object({
|
|
|
37
37
|
project_id: zod_1.z.string(),
|
|
38
38
|
user_id: zod_1.z.string().nullable().optional(),
|
|
39
39
|
disable_task_tracking: zod_1.z.boolean(),
|
|
40
|
-
space_id: zod_1.z.string().nullable(),
|
|
41
40
|
configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable(),
|
|
42
41
|
created_at: zod_1.z.string(),
|
|
43
42
|
updated_at: zod_1.z.string(),
|
|
@@ -51,7 +50,6 @@ exports.TaskDataSchema = zod_1.z.object({
|
|
|
51
50
|
task_description: zod_1.z.string(),
|
|
52
51
|
progresses: zod_1.z.array(zod_1.z.string()).nullable().optional(),
|
|
53
52
|
user_preferences: zod_1.z.array(zod_1.z.string()).nullable().optional(),
|
|
54
|
-
sop_thinking: zod_1.z.string().nullable().optional(),
|
|
55
53
|
});
|
|
56
54
|
exports.TaskSchema = zod_1.z.object({
|
|
57
55
|
id: zod_1.z.string(),
|
|
@@ -61,7 +59,6 @@ exports.TaskSchema = zod_1.z.object({
|
|
|
61
59
|
data: exports.TaskDataSchema,
|
|
62
60
|
status: zod_1.z.string(),
|
|
63
61
|
is_planning: zod_1.z.boolean(),
|
|
64
|
-
space_digested: zod_1.z.boolean(),
|
|
65
62
|
created_at: zod_1.z.string(),
|
|
66
63
|
updated_at: zod_1.z.string(),
|
|
67
64
|
});
|
|
@@ -96,10 +93,6 @@ exports.GetTasksOutputSchema = zod_1.z.object({
|
|
|
96
93
|
next_cursor: zod_1.z.string().nullable().optional(),
|
|
97
94
|
has_more: zod_1.z.boolean(),
|
|
98
95
|
});
|
|
99
|
-
exports.LearningStatusSchema = zod_1.z.object({
|
|
100
|
-
space_digested_count: zod_1.z.number(),
|
|
101
|
-
not_space_digested_count: zod_1.z.number(),
|
|
102
|
-
});
|
|
103
96
|
exports.TokenCountsSchema = zod_1.z.object({
|
|
104
97
|
total_tokens: zod_1.z.number(),
|
|
105
98
|
});
|
package/dist/types/skill.d.ts
CHANGED
|
@@ -45,3 +45,10 @@ export declare const GetSkillFileRespSchema: z.ZodObject<{
|
|
|
45
45
|
}, z.core.$strip>>>;
|
|
46
46
|
}, z.core.$strip>;
|
|
47
47
|
export type GetSkillFileResp = z.infer<typeof GetSkillFileRespSchema>;
|
|
48
|
+
export declare const DownloadSkillToSandboxRespSchema: z.ZodObject<{
|
|
49
|
+
success: z.ZodBoolean;
|
|
50
|
+
dir_path: z.ZodString;
|
|
51
|
+
name: z.ZodString;
|
|
52
|
+
description: z.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type DownloadSkillToSandboxResp = z.infer<typeof DownloadSkillToSandboxRespSchema>;
|
package/dist/types/skill.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Type definitions for skill resources.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GetSkillFileRespSchema = exports.ListSkillsOutputSchema = exports.SkillCatalogItemSchema = exports.SkillSchema = exports.FileInfoSchema = void 0;
|
|
6
|
+
exports.DownloadSkillToSandboxRespSchema = exports.GetSkillFileRespSchema = exports.ListSkillsOutputSchema = exports.SkillCatalogItemSchema = exports.SkillSchema = exports.FileInfoSchema = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
const common_1 = require("./common");
|
|
9
9
|
exports.FileInfoSchema = zod_1.z.object({
|
|
@@ -35,3 +35,9 @@ exports.GetSkillFileRespSchema = zod_1.z.object({
|
|
|
35
35
|
url: zod_1.z.string().nullable().optional(),
|
|
36
36
|
content: common_1.FileContentSchema.nullable().optional(),
|
|
37
37
|
});
|
|
38
|
+
exports.DownloadSkillToSandboxRespSchema = zod_1.z.object({
|
|
39
|
+
success: zod_1.z.boolean(),
|
|
40
|
+
dir_path: zod_1.z.string(),
|
|
41
|
+
name: zod_1.z.string(),
|
|
42
|
+
description: zod_1.z.string(),
|
|
43
|
+
});
|
package/dist/types/tool.d.ts
CHANGED
|
@@ -17,7 +17,3 @@ export declare const FlagResponseSchema: z.ZodObject<{
|
|
|
17
17
|
errmsg: z.ZodString;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
19
|
export type FlagResponse = z.infer<typeof FlagResponseSchema>;
|
|
20
|
-
export declare const InsertBlockResponseSchema: z.ZodObject<{
|
|
21
|
-
id: z.ZodString;
|
|
22
|
-
}, z.core.$strip>;
|
|
23
|
-
export type InsertBlockResponse = z.infer<typeof InsertBlockResponseSchema>;
|
package/dist/types/tool.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Type definitions for tool resources.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.FlagResponseSchema = exports.ToolReferenceDataSchema = exports.ToolRenameItemSchema = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
exports.ToolRenameItemSchema = zod_1.z.object({
|
|
9
9
|
oldName: zod_1.z.string(),
|
|
@@ -17,6 +17,3 @@ exports.FlagResponseSchema = zod_1.z.object({
|
|
|
17
17
|
status: zod_1.z.number(),
|
|
18
18
|
errmsg: zod_1.z.string(),
|
|
19
19
|
});
|
|
20
|
-
exports.InsertBlockResponseSchema = zod_1.z.object({
|
|
21
|
-
id: zod_1.z.string(),
|
|
22
|
-
});
|