@acontext/acontext 0.1.3 → 0.1.5

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/client.d.ts CHANGED
@@ -4,7 +4,6 @@
4
4
  import { DisksAPI } from './resources/disks';
5
5
  import { SandboxesAPI } from './resources/sandboxes';
6
6
  import { SessionsAPI } from './resources/sessions';
7
- import { ToolsAPI } from './resources/tools';
8
7
  import { SkillsAPI } from './resources/skills';
9
8
  import { UsersAPI } from './resources/users';
10
9
  import { RequesterProtocol } from './client-types';
@@ -22,7 +21,6 @@ export declare class AcontextClient implements RequesterProtocol {
22
21
  sessions: SessionsAPI;
23
22
  disks: DisksAPI;
24
23
  artifacts: DisksAPI['artifacts'];
25
- tools: ToolsAPI;
26
24
  skills: SkillsAPI;
27
25
  users: UsersAPI;
28
26
  sandboxes: SandboxesAPI;
package/dist/client.js CHANGED
@@ -41,7 +41,6 @@ const errors_1 = require("./errors");
41
41
  const disks_1 = require("./resources/disks");
42
42
  const sandboxes_1 = require("./resources/sandboxes");
43
43
  const sessions_1 = require("./resources/sessions");
44
- const tools_1 = require("./resources/tools");
45
44
  const skills_1 = require("./resources/skills");
46
45
  const users_1 = require("./resources/users");
47
46
  const constants_1 = require("./constants");
@@ -75,7 +74,6 @@ class AcontextClient {
75
74
  this.sessions = new sessions_1.SessionsAPI(this);
76
75
  this.disks = new disks_1.DisksAPI(this);
77
76
  this.artifacts = this.disks.artifacts;
78
- this.tools = new tools_1.ToolsAPI(this);
79
77
  this.skills = new skills_1.SkillsAPI(this);
80
78
  this.users = new users_1.UsersAPI(this);
81
79
  this.sandboxes = new sandboxes_1.SandboxesAPI(this);
@@ -3,7 +3,6 @@
3
3
  */
4
4
  export * from './sessions';
5
5
  export * from './disks';
6
- export * from './tools';
7
6
  export * from './skills';
8
7
  export * from './sandboxes';
9
8
  export * from './users';
@@ -19,7 +19,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  __exportStar(require("./sessions"), exports);
21
21
  __exportStar(require("./disks"), exports);
22
- __exportStar(require("./tools"), exports);
23
22
  __exportStar(require("./skills"), exports);
24
23
  __exportStar(require("./sandboxes"), exports);
25
24
  __exportStar(require("./users"), exports);
@@ -9,16 +9,43 @@ export type MessageBlob = AcontextMessage | Record<string, unknown>;
9
9
  export declare class SessionsAPI {
10
10
  private requester;
11
11
  constructor(requester: RequesterProtocol);
12
+ /**
13
+ * List all sessions in the project.
14
+ *
15
+ * @param options - Options for listing sessions.
16
+ * @param options.user - Filter by user identifier.
17
+ * @param options.limit - Maximum number of sessions to return.
18
+ * @param options.cursor - Cursor for pagination.
19
+ * @param options.timeDesc - Order by created_at descending if true, ascending if false.
20
+ * @param options.filterByConfigs - Filter by session configs using JSONB containment.
21
+ * Only sessions where configs contains all key-value pairs in this object will be returned.
22
+ * Supports nested objects. Note: Matching is case-sensitive and type-sensitive.
23
+ * Sessions with NULL configs are excluded from filtered results.
24
+ * @returns ListSessionsOutput containing the list of sessions and pagination information.
25
+ */
12
26
  list(options?: {
13
27
  user?: string | null;
14
28
  limit?: number | null;
15
29
  cursor?: string | null;
16
30
  timeDesc?: boolean | null;
31
+ filterByConfigs?: Record<string, unknown> | null;
17
32
  }): Promise<ListSessionsOutput>;
33
+ /**
34
+ * Create a new session.
35
+ *
36
+ * @param options - Options for creating a session.
37
+ * @param options.user - Optional user identifier string.
38
+ * @param options.disableTaskTracking - Whether to disable task tracking for this session.
39
+ * @param options.configs - Optional session configuration dictionary.
40
+ * @param options.useUuid - Optional UUID string to use as the session ID. If not provided, a UUID will be auto-generated.
41
+ * If a session with this UUID already exists, a 409 Conflict error will be raised.
42
+ * @returns The created Session object.
43
+ */
18
44
  create(options?: {
19
45
  user?: string | null;
20
46
  disableTaskTracking?: boolean | null;
21
47
  configs?: Record<string, unknown>;
48
+ useUuid?: string | null;
22
49
  }): Promise<Session>;
23
50
  delete(sessionId: string): Promise<void>;
24
51
  updateConfigs(sessionId: string, options: {
@@ -11,11 +11,29 @@ class SessionsAPI {
11
11
  constructor(requester) {
12
12
  this.requester = requester;
13
13
  }
14
+ /**
15
+ * List all sessions in the project.
16
+ *
17
+ * @param options - Options for listing sessions.
18
+ * @param options.user - Filter by user identifier.
19
+ * @param options.limit - Maximum number of sessions to return.
20
+ * @param options.cursor - Cursor for pagination.
21
+ * @param options.timeDesc - Order by created_at descending if true, ascending if false.
22
+ * @param options.filterByConfigs - Filter by session configs using JSONB containment.
23
+ * Only sessions where configs contains all key-value pairs in this object will be returned.
24
+ * Supports nested objects. Note: Matching is case-sensitive and type-sensitive.
25
+ * Sessions with NULL configs are excluded from filtered results.
26
+ * @returns ListSessionsOutput containing the list of sessions and pagination information.
27
+ */
14
28
  async list(options) {
15
29
  const params = {};
16
30
  if (options?.user) {
17
31
  params.user = options.user;
18
32
  }
33
+ // Handle filterByConfigs - JSON encode, skip empty object
34
+ if (options?.filterByConfigs && Object.keys(options.filterByConfigs).length > 0) {
35
+ params.filter_by_configs = JSON.stringify(options.filterByConfigs);
36
+ }
19
37
  Object.assign(params, (0, utils_1.buildParams)({
20
38
  limit: options?.limit ?? null,
21
39
  cursor: options?.cursor ?? null,
@@ -26,6 +44,17 @@ class SessionsAPI {
26
44
  });
27
45
  return types_1.ListSessionsOutputSchema.parse(data);
28
46
  }
47
+ /**
48
+ * Create a new session.
49
+ *
50
+ * @param options - Options for creating a session.
51
+ * @param options.user - Optional user identifier string.
52
+ * @param options.disableTaskTracking - Whether to disable task tracking for this session.
53
+ * @param options.configs - Optional session configuration dictionary.
54
+ * @param options.useUuid - Optional UUID string to use as the session ID. If not provided, a UUID will be auto-generated.
55
+ * If a session with this UUID already exists, a 409 Conflict error will be raised.
56
+ * @returns The created Session object.
57
+ */
29
58
  async create(options) {
30
59
  const payload = {};
31
60
  if (options?.user !== undefined && options?.user !== null) {
@@ -37,6 +66,9 @@ class SessionsAPI {
37
66
  if (options?.configs !== undefined) {
38
67
  payload.configs = options.configs;
39
68
  }
69
+ if (options?.useUuid !== undefined && options?.useUuid !== null) {
70
+ payload.use_uuid = options.useUuid;
71
+ }
40
72
  const data = await this.requester.request('POST', '/session', {
41
73
  jsonData: Object.keys(payload).length > 0 ? payload : undefined,
42
74
  });
@@ -7,3 +7,8 @@ export declare const FileContentSchema: z.ZodObject<{
7
7
  raw: z.ZodString;
8
8
  }, z.core.$strip>;
9
9
  export type FileContent = z.infer<typeof FileContentSchema>;
10
+ export declare const FlagResponseSchema: z.ZodObject<{
11
+ status: z.ZodNumber;
12
+ errmsg: z.ZodString;
13
+ }, z.core.$strip>;
14
+ export type FlagResponse = z.infer<typeof FlagResponseSchema>;
@@ -3,9 +3,13 @@
3
3
  * Common type definitions shared across modules.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FileContentSchema = void 0;
6
+ exports.FlagResponseSchema = exports.FileContentSchema = void 0;
7
7
  const zod_1 = require("zod");
8
8
  exports.FileContentSchema = zod_1.z.object({
9
9
  type: zod_1.z.string(),
10
10
  raw: zod_1.z.string(),
11
11
  });
12
+ exports.FlagResponseSchema = zod_1.z.object({
13
+ status: zod_1.z.number(),
14
+ errmsg: zod_1.z.string(),
15
+ });
@@ -4,7 +4,6 @@
4
4
  export * from './common';
5
5
  export * from './session';
6
6
  export * from './disk';
7
- export * from './tool';
8
7
  export * from './skill';
9
8
  export * from './sandbox';
10
9
  export * from './user';
@@ -20,7 +20,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
20
20
  __exportStar(require("./common"), exports);
21
21
  __exportStar(require("./session"), exports);
22
22
  __exportStar(require("./disk"), exports);
23
- __exportStar(require("./tool"), exports);
24
23
  __exportStar(require("./skill"), exports);
25
24
  __exportStar(require("./sandbox"), exports);
26
25
  __exportStar(require("./user"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acontext/acontext",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "TypeScript SDK for the Acontext API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,13 +0,0 @@
1
- /**
2
- * Tool endpoints.
3
- */
4
- import { RequesterProtocol } from '../client-types';
5
- import { ToolRenameItem, ToolReferenceData, FlagResponse } from '../types/tool';
6
- export declare class ToolsAPI {
7
- private requester;
8
- constructor(requester: RequesterProtocol);
9
- renameToolName(options: {
10
- rename: ToolRenameItem[];
11
- }): Promise<FlagResponse>;
12
- getToolName(): Promise<ToolReferenceData[]>;
13
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /**
3
- * Tool endpoints.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ToolsAPI = void 0;
7
- const tool_1 = require("../types/tool");
8
- class ToolsAPI {
9
- constructor(requester) {
10
- this.requester = requester;
11
- }
12
- async renameToolName(options) {
13
- const payload = { rename: options.rename };
14
- const data = await this.requester.request('PUT', '/tool/name', {
15
- jsonData: payload,
16
- });
17
- return tool_1.FlagResponseSchema.parse(data);
18
- }
19
- async getToolName() {
20
- const data = await this.requester.request('GET', '/tool/name');
21
- return Array.isArray(data)
22
- ? data.map((item) => tool_1.ToolReferenceDataSchema.parse(item))
23
- : [];
24
- }
25
- }
26
- exports.ToolsAPI = ToolsAPI;
@@ -1,19 +0,0 @@
1
- /**
2
- * Type definitions for tool resources.
3
- */
4
- import { z } from 'zod';
5
- export declare const ToolRenameItemSchema: z.ZodObject<{
6
- oldName: z.ZodString;
7
- newName: z.ZodString;
8
- }, z.core.$strip>;
9
- export type ToolRenameItem = z.infer<typeof ToolRenameItemSchema>;
10
- export declare const ToolReferenceDataSchema: z.ZodObject<{
11
- name: z.ZodString;
12
- sop_count: z.ZodNumber;
13
- }, z.core.$strip>;
14
- export type ToolReferenceData = z.infer<typeof ToolReferenceDataSchema>;
15
- export declare const FlagResponseSchema: z.ZodObject<{
16
- status: z.ZodNumber;
17
- errmsg: z.ZodString;
18
- }, z.core.$strip>;
19
- export type FlagResponse = z.infer<typeof FlagResponseSchema>;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- /**
3
- * Type definitions for tool resources.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FlagResponseSchema = exports.ToolReferenceDataSchema = exports.ToolRenameItemSchema = void 0;
7
- const zod_1 = require("zod");
8
- exports.ToolRenameItemSchema = zod_1.z.object({
9
- oldName: zod_1.z.string(),
10
- newName: zod_1.z.string(),
11
- });
12
- exports.ToolReferenceDataSchema = zod_1.z.object({
13
- name: zod_1.z.string(),
14
- sop_count: zod_1.z.number(),
15
- });
16
- exports.FlagResponseSchema = zod_1.z.object({
17
- status: zod_1.z.number(),
18
- errmsg: zod_1.z.string(),
19
- });