@acontext/acontext 0.0.16 → 0.0.18

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.
@@ -3,3 +3,4 @@
3
3
  */
4
4
  export * from './base';
5
5
  export * from './disk';
6
+ export * from './skill';
@@ -19,3 +19,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  __exportStar(require("./base"), exports);
21
21
  __exportStar(require("./disk"), exports);
22
+ __exportStar(require("./skill"), exports);
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Skill tools for agent operations.
3
+ */
4
+ import { AcontextClient } from '../client';
5
+ import { AbstractBaseTool, BaseContext, BaseToolPool } from './base';
6
+ export interface SkillContext extends BaseContext {
7
+ client: AcontextClient;
8
+ }
9
+ export declare class GetSkillTool extends AbstractBaseTool {
10
+ readonly name = "get_skill";
11
+ readonly description = "Get a skill by its name. Return the skill information including the relative paths of the files and their mime type categories";
12
+ readonly arguments: {
13
+ name: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ };
18
+ readonly requiredArguments: string[];
19
+ execute(ctx: SkillContext, llmArguments: Record<string, unknown>): Promise<string>;
20
+ }
21
+ export declare class GetSkillFileTool extends AbstractBaseTool {
22
+ readonly name = "get_skill_file";
23
+ readonly description = "Get a file from a skill by name. The file_path should be a relative path within the skill (e.g., 'scripts/extract_text.json'). ";
24
+ readonly arguments: {
25
+ skill_name: {
26
+ type: string;
27
+ description: string;
28
+ };
29
+ file_path: {
30
+ type: string;
31
+ description: string;
32
+ };
33
+ expire: {
34
+ type: string;
35
+ description: string;
36
+ };
37
+ };
38
+ readonly requiredArguments: string[];
39
+ execute(ctx: SkillContext, llmArguments: Record<string, unknown>): Promise<string>;
40
+ }
41
+ export declare class SkillToolPool extends BaseToolPool {
42
+ formatContext(client: AcontextClient): SkillContext;
43
+ }
44
+ export declare const SKILL_TOOLS: SkillToolPool;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * Skill tools for agent operations.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SKILL_TOOLS = exports.SkillToolPool = exports.GetSkillFileTool = exports.GetSkillTool = void 0;
7
+ const base_1 = require("./base");
8
+ class GetSkillTool extends base_1.AbstractBaseTool {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.name = 'get_skill';
12
+ this.description = 'Get a skill by its name. Return the skill information including the relative paths of the files and their mime type categories';
13
+ this.arguments = {
14
+ name: {
15
+ type: 'string',
16
+ description: 'The name of the skill (unique within project).',
17
+ },
18
+ };
19
+ this.requiredArguments = ['name'];
20
+ }
21
+ async execute(ctx, llmArguments) {
22
+ const name = llmArguments.name;
23
+ if (!name) {
24
+ throw new Error('name is required');
25
+ }
26
+ const skill = await ctx.client.skills.getByName(name);
27
+ const fileCount = skill.file_index.length;
28
+ // Format all files with path and MIME type
29
+ let fileList;
30
+ if (skill.file_index.length > 0) {
31
+ fileList = skill.file_index
32
+ .map((file) => ` - ${file.path} (${file.mime})`)
33
+ .join('\n');
34
+ }
35
+ else {
36
+ fileList = ' [NO FILES]';
37
+ }
38
+ return (`Skill: ${skill.name} (ID: ${skill.id})\n` +
39
+ `Description: ${skill.description}\n` +
40
+ `Files: ${fileCount} file(s)\n` +
41
+ `${fileList}\n` +
42
+ `Created: ${skill.created_at}\n` +
43
+ `Updated: ${skill.updated_at}`);
44
+ }
45
+ }
46
+ exports.GetSkillTool = GetSkillTool;
47
+ class GetSkillFileTool extends base_1.AbstractBaseTool {
48
+ constructor() {
49
+ super(...arguments);
50
+ this.name = 'get_skill_file';
51
+ this.description = "Get a file from a skill by name. The file_path should be a relative path within the skill (e.g., 'scripts/extract_text.json'). ";
52
+ this.arguments = {
53
+ skill_name: {
54
+ type: 'string',
55
+ description: 'The name of the skill.',
56
+ },
57
+ file_path: {
58
+ type: 'string',
59
+ description: "Relative path to the file within the skill (e.g., 'scripts/extract_text.json').",
60
+ },
61
+ expire: {
62
+ type: 'number',
63
+ description: 'URL expiration time in seconds (only used for non-parseable files). Defaults to 900 (15 minutes).',
64
+ },
65
+ };
66
+ this.requiredArguments = ['skill_name', 'file_path'];
67
+ }
68
+ async execute(ctx, llmArguments) {
69
+ const skillName = llmArguments.skill_name;
70
+ const filePath = llmArguments.file_path;
71
+ const expire = llmArguments.expire;
72
+ if (!filePath) {
73
+ throw new Error('file_path is required');
74
+ }
75
+ if (!skillName) {
76
+ throw new Error('skill_name is required');
77
+ }
78
+ const result = await ctx.client.skills.getFileByName({
79
+ skillName,
80
+ filePath,
81
+ expire: expire || null,
82
+ });
83
+ const outputParts = [
84
+ `File '${result.path}' (MIME: ${result.mime}) from skill '${skillName}':`,
85
+ ];
86
+ if (result.content) {
87
+ outputParts.push(`\nContent (type: ${result.content.type}):`);
88
+ outputParts.push(result.content.raw);
89
+ }
90
+ if (result.url) {
91
+ const expireSeconds = expire || 900;
92
+ outputParts.push(`\nDownload URL (expires in ${expireSeconds} seconds):`);
93
+ outputParts.push(result.url);
94
+ }
95
+ if (!result.content && !result.url) {
96
+ return `File '${filePath}' retrieved but no content or URL returned.`;
97
+ }
98
+ return outputParts.join('\n');
99
+ }
100
+ }
101
+ exports.GetSkillFileTool = GetSkillFileTool;
102
+ class SkillToolPool extends base_1.BaseToolPool {
103
+ formatContext(client) {
104
+ return {
105
+ client,
106
+ };
107
+ }
108
+ }
109
+ exports.SkillToolPool = SkillToolPool;
110
+ exports.SKILL_TOOLS = new SkillToolPool();
111
+ exports.SKILL_TOOLS.addTool(new GetSkillTool());
112
+ exports.SKILL_TOOLS.addTool(new GetSkillFileTool());
package/dist/client.d.ts CHANGED
@@ -6,6 +6,8 @@ import { DisksAPI } from './resources/disks';
6
6
  import { SessionsAPI } from './resources/sessions';
7
7
  import { SpacesAPI } from './resources/spaces';
8
8
  import { ToolsAPI } from './resources/tools';
9
+ import { SkillsAPI } from './resources/skills';
10
+ import { UsersAPI } from './resources/users';
9
11
  import { RequesterProtocol } from './client-types';
10
12
  export interface AcontextClientOptions {
11
13
  apiKey?: string | null;
@@ -24,6 +26,8 @@ export declare class AcontextClient implements RequesterProtocol {
24
26
  artifacts: DisksAPI['artifacts'];
25
27
  blocks: BlocksAPI;
26
28
  tools: ToolsAPI;
29
+ skills: SkillsAPI;
30
+ users: UsersAPI;
27
31
  constructor(options?: AcontextClientOptions);
28
32
  get baseUrl(): string;
29
33
  /**
package/dist/client.js CHANGED
@@ -43,6 +43,8 @@ const disks_1 = require("./resources/disks");
43
43
  const sessions_1 = require("./resources/sessions");
44
44
  const spaces_1 = require("./resources/spaces");
45
45
  const tools_1 = require("./resources/tools");
46
+ const skills_1 = require("./resources/skills");
47
+ const users_1 = require("./resources/users");
46
48
  const constants_1 = require("./constants");
47
49
  class AcontextClient {
48
50
  constructor(options = {}) {
@@ -77,6 +79,8 @@ class AcontextClient {
77
79
  this.artifacts = this.disks.artifacts;
78
80
  this.blocks = new blocks_1.BlocksAPI(this);
79
81
  this.tools = new tools_1.ToolsAPI(this);
82
+ this.skills = new skills_1.SkillsAPI(this);
83
+ this.users = new users_1.UsersAPI(this);
80
84
  }
81
85
  get baseUrl() {
82
86
  return this._baseUrl;
@@ -9,11 +9,14 @@ export declare class DisksAPI {
9
9
  private requester;
10
10
  constructor(requester: RequesterProtocol);
11
11
  list(options?: {
12
+ user?: string | null;
12
13
  limit?: number | null;
13
14
  cursor?: string | null;
14
15
  timeDesc?: boolean | null;
15
16
  }): Promise<ListDisksOutput>;
16
- create(): Promise<Disk>;
17
+ create(options?: {
18
+ user?: string | null;
19
+ }): Promise<Disk>;
17
20
  delete(diskId: string): Promise<void>;
18
21
  }
19
22
  export declare class DiskArtifactsAPI {
@@ -14,6 +14,7 @@ class DisksAPI {
14
14
  }
15
15
  async list(options) {
16
16
  const params = (0, utils_1.buildParams)({
17
+ user: options?.user ?? null,
17
18
  limit: options?.limit ?? null,
18
19
  cursor: options?.cursor ?? null,
19
20
  time_desc: options?.timeDesc ?? null,
@@ -23,8 +24,14 @@ class DisksAPI {
23
24
  });
24
25
  return types_1.ListDisksOutputSchema.parse(data);
25
26
  }
26
- async create() {
27
- const data = await this.requester.request('POST', '/disk');
27
+ async create(options) {
28
+ const payload = {};
29
+ if (options?.user !== undefined && options?.user !== null) {
30
+ payload.user = options.user;
31
+ }
32
+ const data = await this.requester.request('POST', '/disk', {
33
+ jsonData: Object.keys(payload).length > 0 ? payload : undefined,
34
+ });
28
35
  return types_1.DiskSchema.parse(data);
29
36
  }
30
37
  async delete(diskId) {
@@ -6,3 +6,5 @@ export * from './sessions';
6
6
  export * from './disks';
7
7
  export * from './blocks';
8
8
  export * from './tools';
9
+ export * from './skills';
10
+ export * from './users';
@@ -22,3 +22,5 @@ __exportStar(require("./sessions"), exports);
22
22
  __exportStar(require("./disks"), exports);
23
23
  __exportStar(require("./blocks"), exports);
24
24
  __exportStar(require("./tools"), exports);
25
+ __exportStar(require("./skills"), exports);
26
+ __exportStar(require("./users"), exports);
@@ -10,6 +10,7 @@ export declare class SessionsAPI {
10
10
  private requester;
11
11
  constructor(requester: RequesterProtocol);
12
12
  list(options?: {
13
+ user?: string | null;
13
14
  spaceId?: string | null;
14
15
  notConnected?: boolean | null;
15
16
  limit?: number | null;
@@ -17,6 +18,7 @@ export declare class SessionsAPI {
17
18
  timeDesc?: boolean | null;
18
19
  }): Promise<ListSessionsOutput>;
19
20
  create(options?: {
21
+ user?: string | null;
20
22
  spaceId?: string | null;
21
23
  disableTaskTracking?: boolean | null;
22
24
  configs?: Record<string, unknown>;
@@ -53,6 +55,11 @@ export declare class SessionsAPI {
53
55
  * Examples:
54
56
  * - Remove tool results: [{ type: 'remove_tool_result', params: { keep_recent_n_tool_results: 3 } }]
55
57
  * - Token limit: [{ type: 'token_limit', params: { limit_tokens: 20000 } }]
58
+ * @param options.pinEditingStrategiesAtMessage - Message ID to pin editing strategies at.
59
+ * When provided, strategies are only applied to messages up to and including this message ID,
60
+ * keeping subsequent messages unchanged. This helps maintain prompt cache stability by
61
+ * preserving a stable prefix. The response includes edit_at_message_id indicating where
62
+ * strategies were applied. Pass this value in subsequent requests to maintain cache hits.
56
63
  * @returns GetMessagesOutput containing the list of messages and pagination information.
57
64
  */
58
65
  getMessages(sessionId: string, options?: {
@@ -62,6 +69,7 @@ export declare class SessionsAPI {
62
69
  format?: 'acontext' | 'openai' | 'anthropic' | 'gemini';
63
70
  timeDesc?: boolean | null;
64
71
  editStrategies?: Array<EditStrategy> | null;
72
+ pinEditingStrategiesAtMessage?: string | null;
65
73
  }): Promise<GetMessagesOutput>;
66
74
  flush(sessionId: string): Promise<{
67
75
  status: number;
@@ -13,6 +13,9 @@ class SessionsAPI {
13
13
  }
14
14
  async list(options) {
15
15
  const params = {};
16
+ if (options?.user) {
17
+ params.user = options.user;
18
+ }
16
19
  if (options?.spaceId) {
17
20
  params.space_id = options.spaceId;
18
21
  }
@@ -29,6 +32,9 @@ class SessionsAPI {
29
32
  }
30
33
  async create(options) {
31
34
  const payload = {};
35
+ if (options?.user !== undefined && options?.user !== null) {
36
+ payload.user = options.user;
37
+ }
32
38
  if (options?.spaceId) {
33
39
  payload.space_id = options.spaceId;
34
40
  }
@@ -132,6 +138,11 @@ class SessionsAPI {
132
138
  * Examples:
133
139
  * - Remove tool results: [{ type: 'remove_tool_result', params: { keep_recent_n_tool_results: 3 } }]
134
140
  * - Token limit: [{ type: 'token_limit', params: { limit_tokens: 20000 } }]
141
+ * @param options.pinEditingStrategiesAtMessage - Message ID to pin editing strategies at.
142
+ * When provided, strategies are only applied to messages up to and including this message ID,
143
+ * keeping subsequent messages unchanged. This helps maintain prompt cache stability by
144
+ * preserving a stable prefix. The response includes edit_at_message_id indicating where
145
+ * strategies were applied. Pass this value in subsequent requests to maintain cache hits.
135
146
  * @returns GetMessagesOutput containing the list of messages and pagination information.
136
147
  */
137
148
  async getMessages(sessionId, options) {
@@ -148,6 +159,9 @@ class SessionsAPI {
148
159
  if (options?.editStrategies !== undefined && options?.editStrategies !== null) {
149
160
  params.edit_strategies = JSON.stringify(options.editStrategies);
150
161
  }
162
+ if (options?.pinEditingStrategiesAtMessage !== undefined && options?.pinEditingStrategiesAtMessage !== null) {
163
+ params.pin_editing_strategies_at_message = options.pinEditingStrategiesAtMessage;
164
+ }
151
165
  const data = await this.requester.request('GET', `/session/${sessionId}/messages`, {
152
166
  params: Object.keys(params).length > 0 ? params : undefined,
153
167
  });
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Skills endpoints.
3
+ */
4
+ import { RequesterProtocol } from '../client-types';
5
+ import { FileUpload } from '../uploads';
6
+ import { GetSkillFileResp, ListSkillsOutput, Skill } from '../types';
7
+ export declare class SkillsAPI {
8
+ private requester;
9
+ constructor(requester: RequesterProtocol);
10
+ create(options: {
11
+ file: FileUpload | [string, Buffer | NodeJS.ReadableStream] | [string, Buffer | NodeJS.ReadableStream, string | null];
12
+ user?: string | null;
13
+ meta?: Record<string, unknown> | null;
14
+ }): Promise<Skill>;
15
+ /**
16
+ * Get a catalog of skills (names and descriptions only) with pagination.
17
+ *
18
+ * @param options - Pagination options
19
+ * @param options.user - Filter by user identifier (optional)
20
+ * @param options.limit - Maximum number of skills per page (defaults to 100, max 200)
21
+ * @param options.cursor - Cursor for pagination to fetch the next page (optional)
22
+ * @param options.timeDesc - Order by created_at descending if true, ascending if false (defaults to false)
23
+ * @returns ListSkillsOutput containing skills with name and description for the current page,
24
+ * along with pagination information (next_cursor and has_more)
25
+ */
26
+ list_catalog(options?: {
27
+ user?: string | null;
28
+ limit?: number | null;
29
+ cursor?: string | null;
30
+ timeDesc?: boolean | null;
31
+ }): Promise<ListSkillsOutput>;
32
+ getByName(name: string): Promise<Skill>;
33
+ delete(skillId: string): Promise<void>;
34
+ getFileByName(options: {
35
+ skillName: string;
36
+ filePath: string;
37
+ expire?: number | null;
38
+ }): Promise<GetSkillFileResp>;
39
+ }
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ /**
3
+ * Skills endpoints.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SkillsAPI = void 0;
7
+ const zod_1 = require("zod");
8
+ const uploads_1 = require("../uploads");
9
+ const utils_1 = require("../utils");
10
+ const types_1 = require("../types");
11
+ class SkillsAPI {
12
+ constructor(requester) {
13
+ this.requester = requester;
14
+ }
15
+ async create(options) {
16
+ const upload = (0, uploads_1.normalizeFileUpload)(options.file);
17
+ const files = {
18
+ file: upload.asFormData(),
19
+ };
20
+ const form = {};
21
+ if (options.user !== undefined && options.user !== null) {
22
+ form.user = options.user;
23
+ }
24
+ if (options.meta !== undefined && options.meta !== null) {
25
+ form.meta = JSON.stringify(options.meta);
26
+ }
27
+ const data = await this.requester.request('POST', '/agent_skills', {
28
+ data: Object.keys(form).length > 0 ? form : undefined,
29
+ files,
30
+ });
31
+ return types_1.SkillSchema.parse(data);
32
+ }
33
+ /**
34
+ * Get a catalog of skills (names and descriptions only) with pagination.
35
+ *
36
+ * @param options - Pagination options
37
+ * @param options.user - Filter by user identifier (optional)
38
+ * @param options.limit - Maximum number of skills per page (defaults to 100, max 200)
39
+ * @param options.cursor - Cursor for pagination to fetch the next page (optional)
40
+ * @param options.timeDesc - Order by created_at descending if true, ascending if false (defaults to false)
41
+ * @returns ListSkillsOutput containing skills with name and description for the current page,
42
+ * along with pagination information (next_cursor and has_more)
43
+ */
44
+ async list_catalog(options) {
45
+ // Parse API response (contains full Skill objects)
46
+ const apiResponseSchema = zod_1.z.object({
47
+ items: zod_1.z.array(types_1.SkillSchema),
48
+ next_cursor: zod_1.z.string().nullable().optional(),
49
+ has_more: zod_1.z.boolean(),
50
+ });
51
+ // Use 100 as default for catalog listing (only name and description, lightweight)
52
+ const effectiveLimit = options?.limit ?? 100;
53
+ const params = (0, utils_1.buildParams)({
54
+ user: options?.user ?? null,
55
+ limit: effectiveLimit,
56
+ cursor: options?.cursor ?? null,
57
+ time_desc: options?.timeDesc ?? null,
58
+ });
59
+ const data = await this.requester.request('GET', '/agent_skills', {
60
+ params: Object.keys(params).length > 0 ? params : undefined,
61
+ });
62
+ const apiResponse = apiResponseSchema.parse(data);
63
+ // Convert to catalog format (name and description only)
64
+ return types_1.ListSkillsOutputSchema.parse({
65
+ items: apiResponse.items.map((skill) => ({
66
+ name: skill.name,
67
+ description: skill.description,
68
+ })),
69
+ next_cursor: apiResponse.next_cursor ?? null,
70
+ has_more: apiResponse.has_more,
71
+ });
72
+ }
73
+ async getByName(name) {
74
+ const params = { name };
75
+ const data = await this.requester.request('GET', '/agent_skills/by_name', {
76
+ params,
77
+ });
78
+ return types_1.SkillSchema.parse(data);
79
+ }
80
+ async delete(skillId) {
81
+ await this.requester.request('DELETE', `/agent_skills/${skillId}`);
82
+ }
83
+ async getFileByName(options) {
84
+ const endpoint = `/agent_skills/by_name/${options.skillName}/file`;
85
+ const params = {
86
+ file_path: options.filePath,
87
+ };
88
+ if (options.expire !== undefined && options.expire !== null) {
89
+ params.expire = options.expire;
90
+ }
91
+ const data = await this.requester.request('GET', endpoint, {
92
+ params,
93
+ });
94
+ return types_1.GetSkillFileRespSchema.parse(data);
95
+ }
96
+ }
97
+ exports.SkillsAPI = SkillsAPI;
@@ -7,11 +7,13 @@ export declare class SpacesAPI {
7
7
  private requester;
8
8
  constructor(requester: RequesterProtocol);
9
9
  list(options?: {
10
+ user?: string | null;
10
11
  limit?: number | null;
11
12
  cursor?: string | null;
12
13
  timeDesc?: boolean | null;
13
14
  }): Promise<ListSpacesOutput>;
14
15
  create(options?: {
16
+ user?: string | null;
15
17
  configs?: Record<string, unknown>;
16
18
  }): Promise<Space>;
17
19
  delete(spaceId: string): Promise<void>;
@@ -12,6 +12,7 @@ class SpacesAPI {
12
12
  }
13
13
  async list(options) {
14
14
  const params = (0, utils_1.buildParams)({
15
+ user: options?.user ?? null,
15
16
  limit: options?.limit ?? null,
16
17
  cursor: options?.cursor ?? null,
17
18
  time_desc: options?.timeDesc ?? null,
@@ -23,6 +24,9 @@ class SpacesAPI {
23
24
  }
24
25
  async create(options) {
25
26
  const payload = {};
27
+ if (options?.user !== undefined && options?.user !== null) {
28
+ payload.user = options.user;
29
+ }
26
30
  if (options?.configs !== undefined) {
27
31
  payload.configs = options.configs;
28
32
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * User management endpoints.
3
+ */
4
+ import { RequesterProtocol } from '../client-types';
5
+ export declare class UsersAPI {
6
+ private requester;
7
+ constructor(requester: RequesterProtocol);
8
+ /**
9
+ * Delete a user and cascade delete all associated resources (Space, Session, Disk, Skill).
10
+ *
11
+ * @param identifier - The user identifier string
12
+ */
13
+ delete(identifier: string): Promise<void>;
14
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * User management endpoints.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UsersAPI = void 0;
7
+ class UsersAPI {
8
+ constructor(requester) {
9
+ this.requester = requester;
10
+ }
11
+ /**
12
+ * Delete a user and cascade delete all associated resources (Space, Session, Disk, Skill).
13
+ *
14
+ * @param identifier - The user identifier string
15
+ */
16
+ async delete(identifier) {
17
+ await this.requester.request('DELETE', `/user/${encodeURIComponent(identifier)}`);
18
+ }
19
+ }
20
+ exports.UsersAPI = UsersAPI;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Common type definitions shared across modules.
3
+ */
4
+ import { z } from 'zod';
5
+ export declare const FileContentSchema: z.ZodObject<{
6
+ type: z.ZodString;
7
+ raw: z.ZodString;
8
+ }, z.core.$strip>;
9
+ export type FileContent = z.infer<typeof FileContentSchema>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Common type definitions shared across modules.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FileContentSchema = void 0;
7
+ const zod_1 = require("zod");
8
+ exports.FileContentSchema = zod_1.z.object({
9
+ type: zod_1.z.string(),
10
+ raw: zod_1.z.string(),
11
+ });
@@ -5,6 +5,7 @@ import { z } from 'zod';
5
5
  export declare const DiskSchema: z.ZodObject<{
6
6
  id: z.ZodString;
7
7
  project_id: z.ZodString;
8
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
9
  created_at: z.ZodString;
9
10
  updated_at: z.ZodString;
10
11
  }, z.core.$strip>;
@@ -13,6 +14,7 @@ export declare const ListDisksOutputSchema: z.ZodObject<{
13
14
  items: z.ZodArray<z.ZodObject<{
14
15
  id: z.ZodString;
15
16
  project_id: z.ZodString;
17
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
18
  created_at: z.ZodString;
17
19
  updated_at: z.ZodString;
18
20
  }, z.core.$strip>>;
@@ -29,11 +31,6 @@ export declare const ArtifactSchema: z.ZodObject<{
29
31
  updated_at: z.ZodString;
30
32
  }, z.core.$strip>;
31
33
  export type Artifact = z.infer<typeof ArtifactSchema>;
32
- export declare const FileContentSchema: z.ZodObject<{
33
- type: z.ZodString;
34
- raw: z.ZodString;
35
- }, z.core.$strip>;
36
- export type FileContent = z.infer<typeof FileContentSchema>;
37
34
  export declare const GetArtifactRespSchema: z.ZodObject<{
38
35
  artifact: z.ZodObject<{
39
36
  disk_id: z.ZodString;
@@ -3,11 +3,13 @@
3
3
  * Type definitions for disk and artifact resources.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UpdateArtifactRespSchema = exports.ListArtifactsRespSchema = exports.GetArtifactRespSchema = exports.FileContentSchema = exports.ArtifactSchema = exports.ListDisksOutputSchema = exports.DiskSchema = void 0;
6
+ exports.UpdateArtifactRespSchema = exports.ListArtifactsRespSchema = exports.GetArtifactRespSchema = exports.ArtifactSchema = exports.ListDisksOutputSchema = exports.DiskSchema = void 0;
7
7
  const zod_1 = require("zod");
8
+ const common_1 = require("./common");
8
9
  exports.DiskSchema = zod_1.z.object({
9
10
  id: zod_1.z.string(),
10
11
  project_id: zod_1.z.string(),
12
+ user_id: zod_1.z.string().nullable().optional(),
11
13
  created_at: zod_1.z.string(),
12
14
  updated_at: zod_1.z.string(),
13
15
  });
@@ -24,14 +26,10 @@ exports.ArtifactSchema = zod_1.z.object({
24
26
  created_at: zod_1.z.string(),
25
27
  updated_at: zod_1.z.string(),
26
28
  });
27
- exports.FileContentSchema = zod_1.z.object({
28
- type: zod_1.z.string(),
29
- raw: zod_1.z.string(),
30
- });
31
29
  exports.GetArtifactRespSchema = zod_1.z.object({
32
30
  artifact: exports.ArtifactSchema,
33
31
  public_url: zod_1.z.string().nullable().optional(),
34
- content: exports.FileContentSchema.nullable().optional(),
32
+ content: common_1.FileContentSchema.nullable().optional(),
35
33
  });
36
34
  exports.ListArtifactsRespSchema = zod_1.z.object({
37
35
  artifacts: zod_1.z.array(exports.ArtifactSchema),
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * Type exports
3
3
  */
4
+ export * from './common';
4
5
  export * from './space';
5
6
  export * from './session';
6
7
  export * from './disk';
7
8
  export * from './block';
8
9
  export * from './tool';
10
+ export * from './skill';
@@ -17,8 +17,10 @@ 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("./common"), exports);
20
21
  __exportStar(require("./space"), exports);
21
22
  __exportStar(require("./session"), exports);
22
23
  __exportStar(require("./disk"), exports);
23
24
  __exportStar(require("./block"), exports);
24
25
  __exportStar(require("./tool"), exports);
26
+ __exportStar(require("./skill"), exports);
@@ -55,6 +55,7 @@ export type Message = z.infer<typeof MessageSchema>;
55
55
  export declare const SessionSchema: z.ZodObject<{
56
56
  id: z.ZodString;
57
57
  project_id: z.ZodString;
58
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
58
59
  disable_task_tracking: z.ZodBoolean;
59
60
  space_id: z.ZodNullable<z.ZodString>;
60
61
  configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -96,6 +97,7 @@ export declare const ListSessionsOutputSchema: z.ZodObject<{
96
97
  items: z.ZodArray<z.ZodObject<{
97
98
  id: z.ZodString;
98
99
  project_id: z.ZodString;
100
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
101
  disable_task_tracking: z.ZodBoolean;
100
102
  space_id: z.ZodNullable<z.ZodString>;
101
103
  configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -116,10 +118,12 @@ export declare const GetMessagesOutputSchema: z.ZodObject<{
116
118
  ids: z.ZodArray<z.ZodString>;
117
119
  next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
118
120
  has_more: z.ZodBoolean;
121
+ this_time_tokens: z.ZodNumber;
119
122
  public_urls: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
120
123
  url: z.ZodString;
121
124
  expire_at: z.ZodString;
122
125
  }, z.core.$strip>>>>;
126
+ edit_at_message_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
127
  }, z.core.$strip>;
124
128
  export type GetMessagesOutput = z.infer<typeof GetMessagesOutputSchema>;
125
129
  export declare const GetTasksOutputSchema: z.ZodObject<{
@@ -166,6 +170,7 @@ export type MessageObservingStatus = z.infer<typeof MessageObservingStatusSchema
166
170
  export declare const RemoveToolResultParamsSchema: z.ZodObject<{
167
171
  keep_recent_n_tool_results: z.ZodOptional<z.ZodNumber>;
168
172
  tool_result_placeholder: z.ZodOptional<z.ZodString>;
173
+ keep_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
169
174
  }, z.core.$strip>;
170
175
  export type RemoveToolResultParams = z.infer<typeof RemoveToolResultParamsSchema>;
171
176
  /**
@@ -173,6 +178,7 @@ export type RemoveToolResultParams = z.infer<typeof RemoveToolResultParamsSchema
173
178
  */
174
179
  export declare const RemoveToolCallParamsParamsSchema: z.ZodObject<{
175
180
  keep_recent_n_tool_calls: z.ZodOptional<z.ZodNumber>;
181
+ keep_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
176
182
  }, z.core.$strip>;
177
183
  export type RemoveToolCallParamsParams = z.infer<typeof RemoveToolCallParamsParamsSchema>;
178
184
  /**
@@ -188,6 +194,7 @@ export declare const RemoveToolCallParamsStrategySchema: z.ZodObject<{
188
194
  type: z.ZodLiteral<"remove_tool_call_params">;
189
195
  params: z.ZodObject<{
190
196
  keep_recent_n_tool_calls: z.ZodOptional<z.ZodNumber>;
197
+ keep_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
191
198
  }, z.core.$strip>;
192
199
  }, z.core.$strip>;
193
200
  export type RemoveToolCallParamsStrategy = z.infer<typeof RemoveToolCallParamsStrategySchema>;
@@ -201,6 +208,7 @@ export declare const RemoveToolResultStrategySchema: z.ZodObject<{
201
208
  params: z.ZodObject<{
202
209
  keep_recent_n_tool_results: z.ZodOptional<z.ZodNumber>;
203
210
  tool_result_placeholder: z.ZodOptional<z.ZodString>;
211
+ keep_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
212
  }, z.core.$strip>;
205
213
  }, z.core.$strip>;
206
214
  export type RemoveToolResultStrategy = z.infer<typeof RemoveToolResultStrategySchema>;
@@ -236,11 +244,13 @@ export declare const EditStrategySchema: z.ZodUnion<readonly [z.ZodObject<{
236
244
  params: z.ZodObject<{
237
245
  keep_recent_n_tool_results: z.ZodOptional<z.ZodNumber>;
238
246
  tool_result_placeholder: z.ZodOptional<z.ZodString>;
247
+ keep_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
239
248
  }, z.core.$strip>;
240
249
  }, z.core.$strip>, z.ZodObject<{
241
250
  type: z.ZodLiteral<"remove_tool_call_params">;
242
251
  params: z.ZodObject<{
243
252
  keep_recent_n_tool_calls: z.ZodOptional<z.ZodNumber>;
253
+ keep_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
244
254
  }, z.core.$strip>;
245
255
  }, z.core.$strip>, z.ZodObject<{
246
256
  type: z.ZodLiteral<"token_limit">;
@@ -35,6 +35,7 @@ exports.MessageSchema = zod_1.z.object({
35
35
  exports.SessionSchema = zod_1.z.object({
36
36
  id: zod_1.z.string(),
37
37
  project_id: zod_1.z.string(),
38
+ user_id: zod_1.z.string().nullable().optional(),
38
39
  disable_task_tracking: zod_1.z.boolean(),
39
40
  space_id: zod_1.z.string().nullable(),
40
41
  configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable(),
@@ -78,7 +79,17 @@ exports.GetMessagesOutputSchema = zod_1.z.object({
78
79
  ids: zod_1.z.array(zod_1.z.string()),
79
80
  next_cursor: zod_1.z.string().nullable().optional(),
80
81
  has_more: zod_1.z.boolean(),
82
+ /** Total token count of the returned messages */
83
+ this_time_tokens: zod_1.z.number(),
81
84
  public_urls: zod_1.z.record(zod_1.z.string(), exports.PublicURLSchema).nullable().optional(),
85
+ /**
86
+ * The message ID where edit strategies were applied up to.
87
+ * If pin_editing_strategies_at_message was provided, this equals that value.
88
+ * Otherwise, this is the ID of the last message in the response.
89
+ * Use this value to maintain prompt cache stability by passing it as
90
+ * pin_editing_strategies_at_message in subsequent requests.
91
+ */
92
+ edit_at_message_id: zod_1.z.string().nullable().optional(),
82
93
  });
83
94
  exports.GetTasksOutputSchema = zod_1.z.object({
84
95
  items: zod_1.z.array(exports.TaskSchema),
@@ -112,6 +123,11 @@ exports.RemoveToolResultParamsSchema = zod_1.z.object({
112
123
  * @default "Done"
113
124
  */
114
125
  tool_result_placeholder: zod_1.z.string().optional(),
126
+ /**
127
+ * List of tool names that should never have their results removed.
128
+ * Tool results from these tools are always kept regardless of keep_recent_n_tool_results.
129
+ */
130
+ keep_tools: zod_1.z.array(zod_1.z.string()).optional(),
115
131
  });
116
132
  /**
117
133
  * Parameters for the remove_tool_call_params edit strategy.
@@ -122,6 +138,11 @@ exports.RemoveToolCallParamsParamsSchema = zod_1.z.object({
122
138
  * @default 3
123
139
  */
124
140
  keep_recent_n_tool_calls: zod_1.z.number().optional(),
141
+ /**
142
+ * List of tool names that should never have their parameters removed.
143
+ * Tool calls for these tools always keep their full parameters regardless of keep_recent_n_tool_calls.
144
+ */
145
+ keep_tools: zod_1.z.array(zod_1.z.string()).optional(),
125
146
  });
126
147
  /**
127
148
  * Edit strategy to remove parameters from old tool-call parts.
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Type definitions for skill resources.
3
+ */
4
+ import { z } from 'zod';
5
+ export declare const FileInfoSchema: z.ZodObject<{
6
+ path: z.ZodString;
7
+ mime: z.ZodString;
8
+ }, z.core.$strip>;
9
+ export type FileInfo = z.infer<typeof FileInfoSchema>;
10
+ export declare const SkillSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ name: z.ZodString;
14
+ description: z.ZodString;
15
+ file_index: z.ZodArray<z.ZodObject<{
16
+ path: z.ZodString;
17
+ mime: z.ZodString;
18
+ }, z.core.$strip>>;
19
+ meta: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
20
+ created_at: z.ZodString;
21
+ updated_at: z.ZodString;
22
+ }, z.core.$strip>;
23
+ export type Skill = z.infer<typeof SkillSchema>;
24
+ export declare const SkillCatalogItemSchema: z.ZodObject<{
25
+ name: z.ZodString;
26
+ description: z.ZodString;
27
+ }, z.core.$strip>;
28
+ export type SkillCatalogItem = z.infer<typeof SkillCatalogItemSchema>;
29
+ export declare const ListSkillsOutputSchema: z.ZodObject<{
30
+ items: z.ZodArray<z.ZodObject<{
31
+ name: z.ZodString;
32
+ description: z.ZodString;
33
+ }, z.core.$strip>>;
34
+ next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
+ has_more: z.ZodBoolean;
36
+ }, z.core.$strip>;
37
+ export type ListSkillsOutput = z.infer<typeof ListSkillsOutputSchema>;
38
+ export declare const GetSkillFileRespSchema: z.ZodObject<{
39
+ path: z.ZodString;
40
+ mime: z.ZodString;
41
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
+ content: z.ZodOptional<z.ZodNullable<z.ZodObject<{
43
+ type: z.ZodString;
44
+ raw: z.ZodString;
45
+ }, z.core.$strip>>>;
46
+ }, z.core.$strip>;
47
+ export type GetSkillFileResp = z.infer<typeof GetSkillFileRespSchema>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Type definitions for skill resources.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.GetSkillFileRespSchema = exports.ListSkillsOutputSchema = exports.SkillCatalogItemSchema = exports.SkillSchema = exports.FileInfoSchema = void 0;
7
+ const zod_1 = require("zod");
8
+ const common_1 = require("./common");
9
+ exports.FileInfoSchema = zod_1.z.object({
10
+ path: zod_1.z.string(),
11
+ mime: zod_1.z.string(),
12
+ });
13
+ exports.SkillSchema = zod_1.z.object({
14
+ id: zod_1.z.string(),
15
+ user_id: zod_1.z.string().nullable().optional(),
16
+ name: zod_1.z.string(),
17
+ description: zod_1.z.string(),
18
+ file_index: zod_1.z.array(exports.FileInfoSchema),
19
+ meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable(),
20
+ created_at: zod_1.z.string(),
21
+ updated_at: zod_1.z.string(),
22
+ });
23
+ exports.SkillCatalogItemSchema = zod_1.z.object({
24
+ name: zod_1.z.string(),
25
+ description: zod_1.z.string(),
26
+ });
27
+ exports.ListSkillsOutputSchema = zod_1.z.object({
28
+ items: zod_1.z.array(exports.SkillCatalogItemSchema),
29
+ next_cursor: zod_1.z.string().nullable().optional(),
30
+ has_more: zod_1.z.boolean(),
31
+ });
32
+ exports.GetSkillFileRespSchema = zod_1.z.object({
33
+ path: zod_1.z.string(),
34
+ mime: zod_1.z.string(),
35
+ url: zod_1.z.string().nullable().optional(),
36
+ content: common_1.FileContentSchema.nullable().optional(),
37
+ });
@@ -5,6 +5,7 @@ import { z } from 'zod';
5
5
  export declare const SpaceSchema: z.ZodObject<{
6
6
  id: z.ZodString;
7
7
  project_id: z.ZodString;
8
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
9
  configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
9
10
  created_at: z.ZodString;
10
11
  updated_at: z.ZodString;
@@ -14,6 +15,7 @@ export declare const ListSpacesOutputSchema: z.ZodObject<{
14
15
  items: z.ZodArray<z.ZodObject<{
15
16
  id: z.ZodString;
16
17
  project_id: z.ZodString;
18
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
19
  configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
18
20
  created_at: z.ZodString;
19
21
  updated_at: z.ZodString;
@@ -8,6 +8,7 @@ const zod_1 = require("zod");
8
8
  exports.SpaceSchema = zod_1.z.object({
9
9
  id: zod_1.z.string(),
10
10
  project_id: zod_1.z.string(),
11
+ user_id: zod_1.z.string().nullable().optional(),
11
12
  configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable(),
12
13
  created_at: zod_1.z.string(),
13
14
  updated_at: zod_1.z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acontext/acontext",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "TypeScript SDK for the Acontext API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",