@acontext/acontext 0.0.21 → 0.1.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/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 +100 -0
- package/dist/agent/sandbox.d.ts +102 -0
- package/dist/agent/sandbox.js +309 -0
- package/dist/agent/skill.d.ts +2 -8
- package/dist/agent/skill.js +26 -26
- package/dist/agent/text-editor.d.ts +44 -0
- package/dist/agent/text-editor.js +201 -0
- package/dist/client-types.d.ts +1 -0
- package/dist/client.d.ts +3 -4
- package/dist/client.js +6 -6
- package/dist/resources/disks.d.ts +12 -0
- package/dist/resources/disks.js +24 -0
- package/dist/resources/index.d.ts +1 -2
- package/dist/resources/index.js +1 -2
- package/dist/resources/sandboxes.d.ts +51 -0
- package/dist/resources/sandboxes.js +70 -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 +1 -2
- package/dist/types/index.js +1 -2
- package/dist/types/sandbox.d.ts +64 -0
- package/dist/types/sandbox.js +41 -0
- 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,10 +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';
|
|
5
|
+
import { SandboxesAPI } from './resources/sandboxes';
|
|
6
6
|
import { SessionsAPI } from './resources/sessions';
|
|
7
|
-
import { SpacesAPI } from './resources/spaces';
|
|
8
7
|
import { ToolsAPI } from './resources/tools';
|
|
9
8
|
import { SkillsAPI } from './resources/skills';
|
|
10
9
|
import { UsersAPI } from './resources/users';
|
|
@@ -20,14 +19,13 @@ export declare class AcontextClient implements RequesterProtocol {
|
|
|
20
19
|
private _apiKey;
|
|
21
20
|
private _timeout;
|
|
22
21
|
private _userAgent;
|
|
23
|
-
spaces: SpacesAPI;
|
|
24
22
|
sessions: SessionsAPI;
|
|
25
23
|
disks: DisksAPI;
|
|
26
24
|
artifacts: DisksAPI['artifacts'];
|
|
27
|
-
blocks: BlocksAPI;
|
|
28
25
|
tools: ToolsAPI;
|
|
29
26
|
skills: SkillsAPI;
|
|
30
27
|
users: UsersAPI;
|
|
28
|
+
sandboxes: SandboxesAPI;
|
|
31
29
|
constructor(options?: AcontextClientOptions);
|
|
32
30
|
get baseUrl(): string;
|
|
33
31
|
/**
|
|
@@ -48,6 +46,7 @@ export declare class AcontextClient implements RequesterProtocol {
|
|
|
48
46
|
contentType: string;
|
|
49
47
|
}>;
|
|
50
48
|
unwrap?: boolean;
|
|
49
|
+
timeout?: number;
|
|
51
50
|
}): Promise<T>;
|
|
52
51
|
private handleResponse;
|
|
53
52
|
private getFetch;
|
package/dist/client.js
CHANGED
|
@@ -38,10 +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");
|
|
42
|
+
const sandboxes_1 = require("./resources/sandboxes");
|
|
43
43
|
const sessions_1 = require("./resources/sessions");
|
|
44
|
-
const spaces_1 = require("./resources/spaces");
|
|
45
44
|
const tools_1 = require("./resources/tools");
|
|
46
45
|
const skills_1 = require("./resources/skills");
|
|
47
46
|
const users_1 = require("./resources/users");
|
|
@@ -73,14 +72,13 @@ class AcontextClient {
|
|
|
73
72
|
(typeof process !== 'undefined' && process.env?.ACONTEXT_TIMEOUT
|
|
74
73
|
? parseFloat(process.env.ACONTEXT_TIMEOUT)
|
|
75
74
|
: 320000);
|
|
76
|
-
this.spaces = new spaces_1.SpacesAPI(this);
|
|
77
75
|
this.sessions = new sessions_1.SessionsAPI(this);
|
|
78
76
|
this.disks = new disks_1.DisksAPI(this);
|
|
79
77
|
this.artifacts = this.disks.artifacts;
|
|
80
|
-
this.blocks = new blocks_1.BlocksAPI(this);
|
|
81
78
|
this.tools = new tools_1.ToolsAPI(this);
|
|
82
79
|
this.skills = new skills_1.SkillsAPI(this);
|
|
83
80
|
this.users = new users_1.UsersAPI(this);
|
|
81
|
+
this.sandboxes = new sandboxes_1.SandboxesAPI(this);
|
|
84
82
|
}
|
|
85
83
|
get baseUrl() {
|
|
86
84
|
return this._baseUrl;
|
|
@@ -101,6 +99,8 @@ class AcontextClient {
|
|
|
101
99
|
async request(method, path, options) {
|
|
102
100
|
const unwrap = options?.unwrap !== false;
|
|
103
101
|
const url = `${this._baseUrl}${path}`;
|
|
102
|
+
// Use per-request timeout if provided, otherwise use client default
|
|
103
|
+
const effectiveTimeout = options?.timeout ?? this._timeout;
|
|
104
104
|
try {
|
|
105
105
|
// Build headers
|
|
106
106
|
const headers = {
|
|
@@ -186,7 +186,7 @@ class AcontextClient {
|
|
|
186
186
|
// Make the request
|
|
187
187
|
const fetchImpl = await this.getFetch();
|
|
188
188
|
const controller = new AbortController();
|
|
189
|
-
const timeoutId = setTimeout(() => controller.abort(),
|
|
189
|
+
const timeoutId = setTimeout(() => controller.abort(), effectiveTimeout);
|
|
190
190
|
try {
|
|
191
191
|
const response = await fetchImpl(finalUrl, {
|
|
192
192
|
method,
|
|
@@ -200,7 +200,7 @@ class AcontextClient {
|
|
|
200
200
|
catch (error) {
|
|
201
201
|
clearTimeout(timeoutId);
|
|
202
202
|
if (error instanceof Error && error.name === 'AbortError') {
|
|
203
|
-
throw new errors_1.TransportError(`Request timeout after ${
|
|
203
|
+
throw new errors_1.TransportError(`Request timeout after ${effectiveTimeout}ms`);
|
|
204
204
|
}
|
|
205
205
|
throw error;
|
|
206
206
|
}
|
|
@@ -54,4 +54,16 @@ export declare class DiskArtifactsAPI {
|
|
|
54
54
|
query: string;
|
|
55
55
|
limit?: number;
|
|
56
56
|
}): Promise<Artifacts>;
|
|
57
|
+
downloadToSandbox(diskId: string, options: {
|
|
58
|
+
filePath: string;
|
|
59
|
+
filename: string;
|
|
60
|
+
sandboxId: string;
|
|
61
|
+
sandboxPath: string;
|
|
62
|
+
}): Promise<boolean>;
|
|
63
|
+
uploadFromSandbox(diskId: string, options: {
|
|
64
|
+
sandboxId: string;
|
|
65
|
+
sandboxPath: string;
|
|
66
|
+
sandboxFilename: string;
|
|
67
|
+
filePath: string;
|
|
68
|
+
}): Promise<Artifact>;
|
|
57
69
|
}
|
package/dist/resources/disks.js
CHANGED
|
@@ -122,5 +122,29 @@ class DiskArtifactsAPI {
|
|
|
122
122
|
});
|
|
123
123
|
return types_1.ArtifactsSchema.parse(data);
|
|
124
124
|
}
|
|
125
|
+
async downloadToSandbox(diskId, options) {
|
|
126
|
+
const payload = {
|
|
127
|
+
file_path: options.filePath,
|
|
128
|
+
filename: options.filename,
|
|
129
|
+
sandbox_id: options.sandboxId,
|
|
130
|
+
sandbox_path: options.sandboxPath,
|
|
131
|
+
};
|
|
132
|
+
const data = await this.requester.request('POST', `/disk/${diskId}/artifact/download_to_sandbox`, {
|
|
133
|
+
jsonData: payload,
|
|
134
|
+
});
|
|
135
|
+
return Boolean(data?.success);
|
|
136
|
+
}
|
|
137
|
+
async uploadFromSandbox(diskId, options) {
|
|
138
|
+
const payload = {
|
|
139
|
+
sandbox_id: options.sandboxId,
|
|
140
|
+
sandbox_path: options.sandboxPath,
|
|
141
|
+
sandbox_filename: options.sandboxFilename,
|
|
142
|
+
file_path: options.filePath,
|
|
143
|
+
};
|
|
144
|
+
const data = await this.requester.request('POST', `/disk/${diskId}/artifact/upload_from_sandbox`, {
|
|
145
|
+
jsonData: payload,
|
|
146
|
+
});
|
|
147
|
+
return types_1.ArtifactSchema.parse(data);
|
|
148
|
+
}
|
|
125
149
|
}
|
|
126
150
|
exports.DiskArtifactsAPI = DiskArtifactsAPI;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resource API exports
|
|
3
3
|
*/
|
|
4
|
-
export * from './spaces';
|
|
5
4
|
export * from './sessions';
|
|
6
5
|
export * from './disks';
|
|
7
|
-
export * from './blocks';
|
|
8
6
|
export * from './tools';
|
|
9
7
|
export * from './skills';
|
|
8
|
+
export * from './sandboxes';
|
|
10
9
|
export * from './users';
|
package/dist/resources/index.js
CHANGED
|
@@ -17,10 +17,9 @@ 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);
|
|
24
|
+
__exportStar(require("./sandboxes"), exports);
|
|
26
25
|
__exportStar(require("./users"), exports);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandboxes endpoints.
|
|
3
|
+
*/
|
|
4
|
+
import { RequesterProtocol } from '../client-types';
|
|
5
|
+
import { FlagResponse, GetSandboxLogsOutput, SandboxCommandOutput, SandboxRuntimeInfo } from '../types';
|
|
6
|
+
export declare class SandboxesAPI {
|
|
7
|
+
private requester;
|
|
8
|
+
constructor(requester: RequesterProtocol);
|
|
9
|
+
/**
|
|
10
|
+
* Create and start a new sandbox.
|
|
11
|
+
*
|
|
12
|
+
* @returns SandboxRuntimeInfo containing the sandbox ID, status, and timestamps
|
|
13
|
+
*/
|
|
14
|
+
create(): Promise<SandboxRuntimeInfo>;
|
|
15
|
+
/**
|
|
16
|
+
* Execute a shell command in the sandbox.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Command execution options
|
|
19
|
+
* @param options.sandboxId - The UUID of the sandbox
|
|
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.
|
|
23
|
+
* @returns SandboxCommandOutput containing stdout, stderr, and exit code
|
|
24
|
+
*/
|
|
25
|
+
execCommand(options: {
|
|
26
|
+
sandboxId: string;
|
|
27
|
+
command: string;
|
|
28
|
+
timeout?: number;
|
|
29
|
+
}): Promise<SandboxCommandOutput>;
|
|
30
|
+
/**
|
|
31
|
+
* Kill a running sandbox.
|
|
32
|
+
*
|
|
33
|
+
* @param sandboxId - The UUID of the sandbox to kill
|
|
34
|
+
* @returns FlagResponse with status and error message
|
|
35
|
+
*/
|
|
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>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Sandboxes endpoints.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SandboxesAPI = void 0;
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const types_1 = require("../types");
|
|
9
|
+
class SandboxesAPI {
|
|
10
|
+
constructor(requester) {
|
|
11
|
+
this.requester = requester;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create and start a new sandbox.
|
|
15
|
+
*
|
|
16
|
+
* @returns SandboxRuntimeInfo containing the sandbox ID, status, and timestamps
|
|
17
|
+
*/
|
|
18
|
+
async create() {
|
|
19
|
+
const data = await this.requester.request('POST', '/sandbox');
|
|
20
|
+
return types_1.SandboxRuntimeInfoSchema.parse(data);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Execute a shell command in the sandbox.
|
|
24
|
+
*
|
|
25
|
+
* @param options - Command execution options
|
|
26
|
+
* @param options.sandboxId - The UUID of the sandbox
|
|
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.
|
|
30
|
+
* @returns SandboxCommandOutput containing stdout, stderr, and exit code
|
|
31
|
+
*/
|
|
32
|
+
async execCommand(options) {
|
|
33
|
+
const data = await this.requester.request('POST', `/sandbox/${options.sandboxId}/exec`, {
|
|
34
|
+
jsonData: { command: options.command },
|
|
35
|
+
timeout: options.timeout,
|
|
36
|
+
});
|
|
37
|
+
return types_1.SandboxCommandOutputSchema.parse(data);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Kill a running sandbox.
|
|
41
|
+
*
|
|
42
|
+
* @param sandboxId - The UUID of the sandbox to kill
|
|
43
|
+
* @returns FlagResponse with status and error message
|
|
44
|
+
*/
|
|
45
|
+
async kill(sandboxId) {
|
|
46
|
+
const data = await this.requester.request('DELETE', `/sandbox/${sandboxId}`);
|
|
47
|
+
return types_1.FlagResponseSchema.parse(data);
|
|
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
|
+
}
|
|
69
|
+
}
|
|
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
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Type exports
|
|
3
3
|
*/
|
|
4
4
|
export * from './common';
|
|
5
|
-
export * from './space';
|
|
6
5
|
export * from './session';
|
|
7
6
|
export * from './disk';
|
|
8
|
-
export * from './block';
|
|
9
7
|
export * from './tool';
|
|
10
8
|
export * from './skill';
|
|
9
|
+
export * from './sandbox';
|
|
11
10
|
export * from './user';
|
package/dist/types/index.js
CHANGED
|
@@ -18,10 +18,9 @@ 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);
|
|
25
|
+
__exportStar(require("./sandbox"), exports);
|
|
27
26
|
__exportStar(require("./user"), exports);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for sandbox resources.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const SandboxRuntimeInfoSchema: z.ZodObject<{
|
|
6
|
+
sandbox_id: z.ZodString;
|
|
7
|
+
sandbox_status: z.ZodString;
|
|
8
|
+
sandbox_created_at: z.ZodString;
|
|
9
|
+
sandbox_expires_at: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type SandboxRuntimeInfo = z.infer<typeof SandboxRuntimeInfoSchema>;
|
|
12
|
+
export declare const SandboxCommandOutputSchema: z.ZodObject<{
|
|
13
|
+
stdout: z.ZodString;
|
|
14
|
+
stderr: z.ZodString;
|
|
15
|
+
exit_code: z.ZodNumber;
|
|
16
|
+
}, z.core.$strip>;
|
|
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>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type definitions for sandbox resources.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GetSandboxLogsOutputSchema = exports.SandboxLogSchema = exports.GeneratedFileSchema = exports.HistoryCommandSchema = exports.SandboxCommandOutputSchema = exports.SandboxRuntimeInfoSchema = void 0;
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
exports.SandboxRuntimeInfoSchema = zod_1.z.object({
|
|
9
|
+
sandbox_id: zod_1.z.string(),
|
|
10
|
+
sandbox_status: zod_1.z.string(),
|
|
11
|
+
sandbox_created_at: zod_1.z.string(),
|
|
12
|
+
sandbox_expires_at: zod_1.z.string(),
|
|
13
|
+
});
|
|
14
|
+
exports.SandboxCommandOutputSchema = zod_1.z.object({
|
|
15
|
+
stdout: zod_1.z.string(),
|
|
16
|
+
stderr: zod_1.z.string(),
|
|
17
|
+
exit_code: zod_1.z.number(),
|
|
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>;
|