@acontext/acontext 0.0.21 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/skill.js +1 -3
- package/dist/client.d.ts +2 -0
- package/dist/client.js +2 -0
- package/dist/resources/disks.d.ts +12 -0
- package/dist/resources/disks.js +24 -0
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.js +1 -0
- package/dist/resources/sandboxes.d.ts +34 -0
- package/dist/resources/sandboxes.js +46 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/sandbox.d.ts +17 -0
- package/dist/types/sandbox.js +18 -0
- package/package.json +1 -1
package/dist/agent/skill.js
CHANGED
|
@@ -59,9 +59,7 @@ class ListSkillsTool extends base_1.AbstractBaseTool {
|
|
|
59
59
|
this.arguments = {};
|
|
60
60
|
this.requiredArguments = [];
|
|
61
61
|
}
|
|
62
|
-
async execute(ctx,
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
64
|
-
_llmArguments) {
|
|
62
|
+
async execute(ctx, _llmArguments) {
|
|
65
63
|
if (ctx.skills.size === 0) {
|
|
66
64
|
return 'No skills available in the current context.';
|
|
67
65
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { BlocksAPI } from './resources/blocks';
|
|
5
5
|
import { DisksAPI } from './resources/disks';
|
|
6
|
+
import { SandboxesAPI } from './resources/sandboxes';
|
|
6
7
|
import { SessionsAPI } from './resources/sessions';
|
|
7
8
|
import { SpacesAPI } from './resources/spaces';
|
|
8
9
|
import { ToolsAPI } from './resources/tools';
|
|
@@ -28,6 +29,7 @@ export declare class AcontextClient implements RequesterProtocol {
|
|
|
28
29
|
tools: ToolsAPI;
|
|
29
30
|
skills: SkillsAPI;
|
|
30
31
|
users: UsersAPI;
|
|
32
|
+
sandboxes: SandboxesAPI;
|
|
31
33
|
constructor(options?: AcontextClientOptions);
|
|
32
34
|
get baseUrl(): string;
|
|
33
35
|
/**
|
package/dist/client.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.AcontextClient = void 0;
|
|
|
40
40
|
const errors_1 = require("./errors");
|
|
41
41
|
const blocks_1 = require("./resources/blocks");
|
|
42
42
|
const disks_1 = require("./resources/disks");
|
|
43
|
+
const sandboxes_1 = require("./resources/sandboxes");
|
|
43
44
|
const sessions_1 = require("./resources/sessions");
|
|
44
45
|
const spaces_1 = require("./resources/spaces");
|
|
45
46
|
const tools_1 = require("./resources/tools");
|
|
@@ -81,6 +82,7 @@ class AcontextClient {
|
|
|
81
82
|
this.tools = new tools_1.ToolsAPI(this);
|
|
82
83
|
this.skills = new skills_1.SkillsAPI(this);
|
|
83
84
|
this.users = new users_1.UsersAPI(this);
|
|
85
|
+
this.sandboxes = new sandboxes_1.SandboxesAPI(this);
|
|
84
86
|
}
|
|
85
87
|
get baseUrl() {
|
|
86
88
|
return this._baseUrl;
|
|
@@ -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;
|
package/dist/resources/index.js
CHANGED
|
@@ -23,4 +23,5 @@ __exportStar(require("./disks"), exports);
|
|
|
23
23
|
__exportStar(require("./blocks"), exports);
|
|
24
24
|
__exportStar(require("./tools"), exports);
|
|
25
25
|
__exportStar(require("./skills"), exports);
|
|
26
|
+
__exportStar(require("./sandboxes"), exports);
|
|
26
27
|
__exportStar(require("./users"), exports);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandboxes endpoints.
|
|
3
|
+
*/
|
|
4
|
+
import { RequesterProtocol } from '../client-types';
|
|
5
|
+
import { FlagResponse, 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
|
+
* @returns SandboxCommandOutput containing stdout, stderr, and exit code
|
|
22
|
+
*/
|
|
23
|
+
execCommand(options: {
|
|
24
|
+
sandboxId: string;
|
|
25
|
+
command: string;
|
|
26
|
+
}): Promise<SandboxCommandOutput>;
|
|
27
|
+
/**
|
|
28
|
+
* Kill a running sandbox.
|
|
29
|
+
*
|
|
30
|
+
* @param sandboxId - The UUID of the sandbox to kill
|
|
31
|
+
* @returns FlagResponse with status and error message
|
|
32
|
+
*/
|
|
33
|
+
kill(sandboxId: string): Promise<FlagResponse>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Sandboxes endpoints.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SandboxesAPI = void 0;
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
class SandboxesAPI {
|
|
9
|
+
constructor(requester) {
|
|
10
|
+
this.requester = requester;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create and start a new sandbox.
|
|
14
|
+
*
|
|
15
|
+
* @returns SandboxRuntimeInfo containing the sandbox ID, status, and timestamps
|
|
16
|
+
*/
|
|
17
|
+
async create() {
|
|
18
|
+
const data = await this.requester.request('POST', '/sandbox');
|
|
19
|
+
return types_1.SandboxRuntimeInfoSchema.parse(data);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Execute a shell command in the sandbox.
|
|
23
|
+
*
|
|
24
|
+
* @param options - Command execution options
|
|
25
|
+
* @param options.sandboxId - The UUID of the sandbox
|
|
26
|
+
* @param options.command - The shell command to execute
|
|
27
|
+
* @returns SandboxCommandOutput containing stdout, stderr, and exit code
|
|
28
|
+
*/
|
|
29
|
+
async execCommand(options) {
|
|
30
|
+
const data = await this.requester.request('POST', `/sandbox/${options.sandboxId}/exec`, {
|
|
31
|
+
jsonData: { command: options.command },
|
|
32
|
+
});
|
|
33
|
+
return types_1.SandboxCommandOutputSchema.parse(data);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Kill a running sandbox.
|
|
37
|
+
*
|
|
38
|
+
* @param sandboxId - The UUID of the sandbox to kill
|
|
39
|
+
* @returns FlagResponse with status and error message
|
|
40
|
+
*/
|
|
41
|
+
async kill(sandboxId) {
|
|
42
|
+
const data = await this.requester.request('DELETE', `/sandbox/${sandboxId}`);
|
|
43
|
+
return types_1.FlagResponseSchema.parse(data);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.SandboxesAPI = SandboxesAPI;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -24,4 +24,5 @@ __exportStar(require("./disk"), exports);
|
|
|
24
24
|
__exportStar(require("./block"), exports);
|
|
25
25
|
__exportStar(require("./tool"), exports);
|
|
26
26
|
__exportStar(require("./skill"), exports);
|
|
27
|
+
__exportStar(require("./sandbox"), exports);
|
|
27
28
|
__exportStar(require("./user"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
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>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type definitions for sandbox resources.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
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
|
+
});
|