@acontext/acontext 0.1.10 → 0.1.12

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/README.md CHANGED
@@ -10,4 +10,4 @@ npm install @acontext/acontext
10
10
 
11
11
  # 🔍 Document
12
12
 
13
- To understand more about this SDK, please view [our docs](https://docs.acontext.io/) and [api references](https://docs.acontext.io/api-reference/introduction)
13
+ To understand more about this SDK, please view [our docs](https://docs.acontext.app/) and [api references](https://docs.acontext.app/api-reference/introduction)
@@ -117,7 +117,8 @@ class BashTool extends base_1.AbstractBaseTool {
117
117
  }
118
118
  async execute(ctx, llmArguments) {
119
119
  const command = llmArguments.command;
120
- const timeout = llmArguments.timeout ?? this._timeout;
120
+ const timeoutSec = llmArguments.timeout ?? this._timeout;
121
+ const timeout = timeoutSec != null ? timeoutSec * 1000 : undefined;
121
122
  if (!command) {
122
123
  throw new Error('command is required');
123
124
  }
@@ -177,6 +178,7 @@ class TextEditorTool extends base_1.AbstractBaseTool {
177
178
  async execute(ctx, llmArguments) {
178
179
  const command = llmArguments.command;
179
180
  const path = llmArguments.path;
181
+ const timeoutMs = this._timeout != null ? this._timeout * 1000 : undefined;
180
182
  if (!command) {
181
183
  throw new Error('command is required');
182
184
  }
@@ -185,7 +187,7 @@ class TextEditorTool extends base_1.AbstractBaseTool {
185
187
  }
186
188
  if (command === 'view') {
187
189
  const viewRange = llmArguments.view_range;
188
- const result = await (0, text_editor_1.viewFile)(ctx, path, viewRange, this._timeout);
190
+ const result = await (0, text_editor_1.viewFile)(ctx, path, viewRange, timeoutMs);
189
191
  return JSON.stringify(result);
190
192
  }
191
193
  else if (command === 'create') {
@@ -193,7 +195,7 @@ class TextEditorTool extends base_1.AbstractBaseTool {
193
195
  if (fileText === null || fileText === undefined) {
194
196
  throw new Error('file_text is required for create command');
195
197
  }
196
- const result = await (0, text_editor_1.createFile)(ctx, path, fileText, this._timeout);
198
+ const result = await (0, text_editor_1.createFile)(ctx, path, fileText, timeoutMs);
197
199
  return JSON.stringify(result);
198
200
  }
199
201
  else if (command === 'str_replace') {
@@ -205,7 +207,7 @@ class TextEditorTool extends base_1.AbstractBaseTool {
205
207
  if (newStr === null || newStr === undefined) {
206
208
  throw new Error('new_str is required for str_replace command');
207
209
  }
208
- const result = await (0, text_editor_1.strReplace)(ctx, path, oldStr, newStr, this._timeout);
210
+ const result = await (0, text_editor_1.strReplace)(ctx, path, oldStr, newStr, timeoutMs);
209
211
  return JSON.stringify(result);
210
212
  }
211
213
  else {
package/dist/client.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * High-level synchronous client for the Acontext API.
3
3
  */
4
4
  import { DisksAPI } from './resources/disks';
5
+ import { LearningSpacesAPI } from './resources/learning-spaces';
5
6
  import { SandboxesAPI } from './resources/sandboxes';
6
7
  import { SessionsAPI } from './resources/sessions';
7
8
  import { SkillsAPI } from './resources/skills';
@@ -24,6 +25,7 @@ export declare class AcontextClient implements RequesterProtocol {
24
25
  skills: SkillsAPI;
25
26
  users: UsersAPI;
26
27
  sandboxes: SandboxesAPI;
28
+ learningSpaces: LearningSpacesAPI;
27
29
  constructor(options?: AcontextClientOptions);
28
30
  get baseUrl(): string;
29
31
  /**
package/dist/client.js CHANGED
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.AcontextClient = void 0;
40
40
  const errors_1 = require("./errors");
41
41
  const disks_1 = require("./resources/disks");
42
+ const learning_spaces_1 = require("./resources/learning-spaces");
42
43
  const sandboxes_1 = require("./resources/sandboxes");
43
44
  const sessions_1 = require("./resources/sessions");
44
45
  const skills_1 = require("./resources/skills");
@@ -77,6 +78,7 @@ class AcontextClient {
77
78
  this.skills = new skills_1.SkillsAPI(this);
78
79
  this.users = new users_1.UsersAPI(this);
79
80
  this.sandboxes = new sandboxes_1.SandboxesAPI(this);
81
+ this.learningSpaces = new learning_spaces_1.LearningSpacesAPI(this);
80
82
  }
81
83
  get baseUrl() {
82
84
  return this._baseUrl;
@@ -6,3 +6,4 @@ export * from './disks';
6
6
  export * from './skills';
7
7
  export * from './sandboxes';
8
8
  export * from './users';
9
+ export * from './learning-spaces';
@@ -22,3 +22,4 @@ __exportStar(require("./disks"), exports);
22
22
  __exportStar(require("./skills"), exports);
23
23
  __exportStar(require("./sandboxes"), exports);
24
24
  __exportStar(require("./users"), exports);
25
+ __exportStar(require("./learning-spaces"), exports);
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Learning Spaces endpoints.
3
+ */
4
+ import { RequesterProtocol } from '../client-types';
5
+ import { LearningSpace, LearningSpaceSession, LearningSpaceSkill, ListLearningSpacesOutput, Skill } from '../types';
6
+ export declare class LearningSpacesAPI {
7
+ private requester;
8
+ constructor(requester: RequesterProtocol);
9
+ /**
10
+ * Create a new learning space.
11
+ */
12
+ create(options?: {
13
+ user?: string | null;
14
+ meta?: Record<string, unknown> | null;
15
+ }): Promise<LearningSpace>;
16
+ /**
17
+ * List learning spaces with optional filters and pagination.
18
+ */
19
+ list(options?: {
20
+ user?: string | null;
21
+ limit?: number | null;
22
+ cursor?: string | null;
23
+ timeDesc?: boolean | null;
24
+ filterByMeta?: Record<string, unknown> | null;
25
+ }): Promise<ListLearningSpacesOutput>;
26
+ /**
27
+ * Get a learning space by ID.
28
+ */
29
+ get(spaceId: string): Promise<LearningSpace>;
30
+ /**
31
+ * Update a learning space by merging meta into existing meta.
32
+ */
33
+ update(spaceId: string, options: {
34
+ meta: Record<string, unknown>;
35
+ }): Promise<LearningSpace>;
36
+ /**
37
+ * Delete a learning space by ID.
38
+ */
39
+ delete(spaceId: string): Promise<void>;
40
+ /**
41
+ * Create an async learning record from a session.
42
+ */
43
+ learn(options: {
44
+ spaceId: string;
45
+ sessionId: string;
46
+ }): Promise<LearningSpaceSession>;
47
+ /**
48
+ * List all learning session records for a space.
49
+ */
50
+ listSessions(spaceId: string): Promise<LearningSpaceSession[]>;
51
+ /**
52
+ * Include a skill in a learning space.
53
+ */
54
+ includeSkill(options: {
55
+ spaceId: string;
56
+ skillId: string;
57
+ }): Promise<LearningSpaceSkill>;
58
+ /**
59
+ * List all skills in a learning space. Returns full skill data.
60
+ */
61
+ listSkills(spaceId: string): Promise<Skill[]>;
62
+ /**
63
+ * Remove a skill from a learning space. Idempotent.
64
+ */
65
+ excludeSkill(options: {
66
+ spaceId: string;
67
+ skillId: string;
68
+ }): Promise<void>;
69
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ /**
3
+ * Learning Spaces endpoints.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LearningSpacesAPI = void 0;
7
+ const utils_1 = require("../utils");
8
+ const types_1 = require("../types");
9
+ class LearningSpacesAPI {
10
+ constructor(requester) {
11
+ this.requester = requester;
12
+ }
13
+ /**
14
+ * Create a new learning space.
15
+ */
16
+ async create(options) {
17
+ const payload = {};
18
+ if (options?.user !== undefined && options.user !== null) {
19
+ payload.user = options.user;
20
+ }
21
+ if (options?.meta !== undefined && options.meta !== null) {
22
+ payload.meta = options.meta;
23
+ }
24
+ const data = await this.requester.request('POST', '/learning_spaces', {
25
+ jsonData: payload,
26
+ });
27
+ return types_1.LearningSpaceSchema.parse(data);
28
+ }
29
+ /**
30
+ * List learning spaces with optional filters and pagination.
31
+ */
32
+ async list(options) {
33
+ const effectiveLimit = options?.limit ?? 20;
34
+ const params = (0, utils_1.buildParams)({
35
+ user: options?.user ?? null,
36
+ limit: effectiveLimit,
37
+ cursor: options?.cursor ?? null,
38
+ time_desc: options?.timeDesc ?? null,
39
+ });
40
+ if (options?.filterByMeta && Object.keys(options.filterByMeta).length > 0) {
41
+ params.filter_by_meta = JSON.stringify(options.filterByMeta);
42
+ }
43
+ const data = await this.requester.request('GET', '/learning_spaces', {
44
+ params: Object.keys(params).length > 0 ? params : undefined,
45
+ });
46
+ return types_1.ListLearningSpacesOutputSchema.parse(data);
47
+ }
48
+ /**
49
+ * Get a learning space by ID.
50
+ */
51
+ async get(spaceId) {
52
+ const data = await this.requester.request('GET', `/learning_spaces/${spaceId}`);
53
+ return types_1.LearningSpaceSchema.parse(data);
54
+ }
55
+ /**
56
+ * Update a learning space by merging meta into existing meta.
57
+ */
58
+ async update(spaceId, options) {
59
+ const data = await this.requester.request('PATCH', `/learning_spaces/${spaceId}`, {
60
+ jsonData: { meta: options.meta },
61
+ });
62
+ return types_1.LearningSpaceSchema.parse(data);
63
+ }
64
+ /**
65
+ * Delete a learning space by ID.
66
+ */
67
+ async delete(spaceId) {
68
+ await this.requester.request('DELETE', `/learning_spaces/${spaceId}`);
69
+ }
70
+ /**
71
+ * Create an async learning record from a session.
72
+ */
73
+ async learn(options) {
74
+ const data = await this.requester.request('POST', `/learning_spaces/${options.spaceId}/learn`, { jsonData: { session_id: options.sessionId } });
75
+ return types_1.LearningSpaceSessionSchema.parse(data);
76
+ }
77
+ /**
78
+ * List all learning session records for a space.
79
+ */
80
+ async listSessions(spaceId) {
81
+ const data = await this.requester.request('GET', `/learning_spaces/${spaceId}/sessions`);
82
+ return data.map((item) => types_1.LearningSpaceSessionSchema.parse(item));
83
+ }
84
+ /**
85
+ * Include a skill in a learning space.
86
+ */
87
+ async includeSkill(options) {
88
+ const data = await this.requester.request('POST', `/learning_spaces/${options.spaceId}/skills`, { jsonData: { skill_id: options.skillId } });
89
+ return types_1.LearningSpaceSkillSchema.parse(data);
90
+ }
91
+ /**
92
+ * List all skills in a learning space. Returns full skill data.
93
+ */
94
+ async listSkills(spaceId) {
95
+ const data = await this.requester.request('GET', `/learning_spaces/${spaceId}/skills`);
96
+ return data.map((item) => types_1.SkillSchema.parse(item));
97
+ }
98
+ /**
99
+ * Remove a skill from a learning space. Idempotent.
100
+ */
101
+ async excludeSkill(options) {
102
+ await this.requester.request('DELETE', `/learning_spaces/${options.spaceId}/skills/${options.skillId}`);
103
+ }
104
+ }
105
+ exports.LearningSpacesAPI = LearningSpacesAPI;
@@ -4,7 +4,7 @@
4
4
  import { RequesterProtocol } from '../client-types';
5
5
  import { AcontextMessage } from '../messages';
6
6
  import { FileUpload } from '../uploads';
7
- import { EditStrategy, GetMessagesOutput, GetTasksOutput, ListSessionsOutput, Message, MessageObservingStatus, Session, TokenCounts } from '../types';
7
+ import { EditStrategy, CopySessionResult, 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;
@@ -195,4 +195,21 @@ export declare class SessionsAPI {
195
195
  * );
196
196
  */
197
197
  patchConfigs(sessionId: string, configs: Record<string, unknown>): Promise<Record<string, unknown>>;
198
+ /**
199
+ * Copy (duplicate) a session with all its messages and tasks.
200
+ *
201
+ * Creates a complete copy of the session including all messages, tasks, and configurations.
202
+ * The copied session will be independent and modifications to it won't affect the original.
203
+ *
204
+ * @param sessionId - The UUID of the session to copy.
205
+ * @returns CopySessionResult containing the original and new session IDs.
206
+ * @throws {Error} If session_id is invalid or session doesn't exist.
207
+ * @throws {Error} If session exceeds maximum copyable size (5000 messages).
208
+ *
209
+ * @example
210
+ * const result = await client.sessions.copy(sessionId);
211
+ * console.log(`Copied session: ${result.newSessionId}`);
212
+ * console.log(`Original session: ${result.oldSessionId}`);
213
+ */
214
+ copy(sessionId: string): Promise<CopySessionResult>;
198
215
  }
@@ -340,5 +340,26 @@ class SessionsAPI {
340
340
  });
341
341
  return data.configs ?? {};
342
342
  }
343
+ /**
344
+ * Copy (duplicate) a session with all its messages and tasks.
345
+ *
346
+ * Creates a complete copy of the session including all messages, tasks, and configurations.
347
+ * The copied session will be independent and modifications to it won't affect the original.
348
+ *
349
+ * @param sessionId - The UUID of the session to copy.
350
+ * @returns CopySessionResult containing the original and new session IDs.
351
+ * @throws {Error} If session_id is invalid or session doesn't exist.
352
+ * @throws {Error} If session exceeds maximum copyable size (5000 messages).
353
+ *
354
+ * @example
355
+ * const result = await client.sessions.copy(sessionId);
356
+ * console.log(`Copied session: ${result.newSessionId}`);
357
+ * console.log(`Original session: ${result.oldSessionId}`);
358
+ */
359
+ async copy(sessionId) {
360
+ (0, utils_1.validateUUID)(sessionId, 'sessionId');
361
+ const data = await this.requester.request('POST', `/session/${sessionId}/copy`);
362
+ return types_1.CopySessionResultSchema.parse(data);
363
+ }
343
364
  }
344
365
  exports.SessionsAPI = SessionsAPI;
@@ -7,3 +7,4 @@ export * from './disk';
7
7
  export * from './skill';
8
8
  export * from './sandbox';
9
9
  export * from './user';
10
+ export * from './learning-space';
@@ -23,3 +23,4 @@ __exportStar(require("./disk"), exports);
23
23
  __exportStar(require("./skill"), exports);
24
24
  __exportStar(require("./sandbox"), exports);
25
25
  __exportStar(require("./user"), exports);
26
+ __exportStar(require("./learning-space"), exports);
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Type definitions for learning space resources.
3
+ */
4
+ import { z } from 'zod';
5
+ export declare const LearningSpaceSchema: z.ZodObject<{
6
+ id: z.ZodString;
7
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
9
+ created_at: z.ZodString;
10
+ updated_at: z.ZodString;
11
+ }, z.core.$strip>;
12
+ export type LearningSpace = z.infer<typeof LearningSpaceSchema>;
13
+ export declare const LearningSpaceSkillSchema: z.ZodObject<{
14
+ id: z.ZodString;
15
+ learning_space_id: z.ZodString;
16
+ skill_id: z.ZodString;
17
+ created_at: z.ZodString;
18
+ }, z.core.$strip>;
19
+ export type LearningSpaceSkill = z.infer<typeof LearningSpaceSkillSchema>;
20
+ export declare const LearningSpaceSessionSchema: z.ZodObject<{
21
+ id: z.ZodString;
22
+ learning_space_id: z.ZodString;
23
+ session_id: z.ZodString;
24
+ status: z.ZodString;
25
+ created_at: z.ZodString;
26
+ updated_at: z.ZodString;
27
+ }, z.core.$strip>;
28
+ export type LearningSpaceSession = z.infer<typeof LearningSpaceSessionSchema>;
29
+ export declare const ListLearningSpacesOutputSchema: z.ZodObject<{
30
+ items: z.ZodArray<z.ZodObject<{
31
+ id: z.ZodString;
32
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
34
+ created_at: z.ZodString;
35
+ updated_at: z.ZodString;
36
+ }, z.core.$strip>>;
37
+ next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
+ has_more: z.ZodBoolean;
39
+ }, z.core.$strip>;
40
+ export type ListLearningSpacesOutput = z.infer<typeof ListLearningSpacesOutputSchema>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * Type definitions for learning space resources.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ListLearningSpacesOutputSchema = exports.LearningSpaceSessionSchema = exports.LearningSpaceSkillSchema = exports.LearningSpaceSchema = void 0;
7
+ const zod_1 = require("zod");
8
+ exports.LearningSpaceSchema = zod_1.z.object({
9
+ id: zod_1.z.string(),
10
+ user_id: zod_1.z.string().nullable().optional(),
11
+ meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable().optional(),
12
+ created_at: zod_1.z.string(),
13
+ updated_at: zod_1.z.string(),
14
+ });
15
+ exports.LearningSpaceSkillSchema = zod_1.z.object({
16
+ id: zod_1.z.string(),
17
+ learning_space_id: zod_1.z.string(),
18
+ skill_id: zod_1.z.string(),
19
+ created_at: zod_1.z.string(),
20
+ });
21
+ exports.LearningSpaceSessionSchema = zod_1.z.object({
22
+ id: zod_1.z.string(),
23
+ learning_space_id: zod_1.z.string(),
24
+ session_id: zod_1.z.string(),
25
+ status: zod_1.z.string(),
26
+ created_at: zod_1.z.string(),
27
+ updated_at: zod_1.z.string(),
28
+ });
29
+ exports.ListLearningSpacesOutputSchema = zod_1.z.object({
30
+ items: zod_1.z.array(exports.LearningSpaceSchema),
31
+ next_cursor: zod_1.z.string().nullable().optional(),
32
+ has_more: zod_1.z.boolean(),
33
+ });
@@ -157,6 +157,11 @@ export declare const MessageObservingStatusSchema: z.ZodObject<{
157
157
  updated_at: z.ZodString;
158
158
  }, z.core.$strip>;
159
159
  export type MessageObservingStatus = z.infer<typeof MessageObservingStatusSchema>;
160
+ export declare const CopySessionResultSchema: z.ZodObject<{
161
+ old_session_id: z.ZodString;
162
+ new_session_id: z.ZodString;
163
+ }, z.core.$strip>;
164
+ export type CopySessionResult = z.infer<typeof CopySessionResultSchema>;
160
165
  /**
161
166
  * Parameters for the remove_tool_result edit strategy.
162
167
  */
@@ -3,7 +3,7 @@
3
3
  * Type definitions for session, message, and task resources.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EditStrategySchema = exports.MiddleOutStrategySchema = exports.MiddleOutParamsSchema = exports.TokenLimitStrategySchema = exports.TokenLimitParamsSchema = exports.RemoveToolResultStrategySchema = exports.RemoveToolCallParamsStrategySchema = exports.RemoveToolCallParamsParamsSchema = exports.RemoveToolResultParamsSchema = exports.MessageObservingStatusSchema = exports.TokenCountsSchema = exports.GetTasksOutputSchema = exports.GetMessagesOutputSchema = exports.PublicURLSchema = exports.ListSessionsOutputSchema = exports.TaskSchema = exports.TaskDataSchema = exports.SessionSchema = exports.MessageSchema = exports.PartSchema = exports.AssetSchema = void 0;
6
+ exports.EditStrategySchema = exports.MiddleOutStrategySchema = exports.MiddleOutParamsSchema = exports.TokenLimitStrategySchema = exports.TokenLimitParamsSchema = exports.RemoveToolResultStrategySchema = exports.RemoveToolCallParamsStrategySchema = exports.RemoveToolCallParamsParamsSchema = exports.RemoveToolResultParamsSchema = exports.CopySessionResultSchema = exports.MessageObservingStatusSchema = exports.TokenCountsSchema = exports.GetTasksOutputSchema = exports.GetMessagesOutputSchema = exports.PublicURLSchema = exports.ListSessionsOutputSchema = exports.TaskSchema = exports.TaskDataSchema = exports.SessionSchema = exports.MessageSchema = exports.PartSchema = exports.AssetSchema = void 0;
7
7
  const zod_1 = require("zod");
8
8
  exports.AssetSchema = zod_1.z.object({
9
9
  bucket: zod_1.z.string(),
@@ -108,6 +108,10 @@ exports.MessageObservingStatusSchema = zod_1.z.object({
108
108
  pending: zod_1.z.number(),
109
109
  updated_at: zod_1.z.string(),
110
110
  });
111
+ exports.CopySessionResultSchema = zod_1.z.object({
112
+ old_session_id: zod_1.z.string(),
113
+ new_session_id: zod_1.z.string(),
114
+ });
111
115
  /**
112
116
  * Parameters for the remove_tool_result edit strategy.
113
117
  */
package/dist/utils.d.ts CHANGED
@@ -9,3 +9,16 @@ export declare function boolToStr(value: boolean): string;
9
9
  * Build query parameters dictionary, filtering None values and converting booleans.
10
10
  */
11
11
  export declare function buildParams(params: Record<string, unknown>): Record<string, string | number>;
12
+ /**
13
+ * Validate that a string is a valid UUID (v1–v5) format.
14
+ * @param uuid - The string to validate.
15
+ * @returns True if valid UUID, false otherwise.
16
+ */
17
+ export declare function isValidUUID(uuid: string): boolean;
18
+ /**
19
+ * Validate UUID and throw error if invalid.
20
+ * @param uuid - The UUID to validate.
21
+ * @param paramName - The parameter name for error message.
22
+ * @throws {Error} If UUID is invalid.
23
+ */
24
+ export declare function validateUUID(uuid: string, paramName?: string): void;
package/dist/utils.js CHANGED
@@ -5,6 +5,8 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.boolToStr = boolToStr;
7
7
  exports.buildParams = buildParams;
8
+ exports.isValidUUID = isValidUUID;
9
+ exports.validateUUID = validateUUID;
8
10
  /**
9
11
  * Convert a boolean value to string representation used by the API.
10
12
  */
@@ -28,3 +30,23 @@ function buildParams(params) {
28
30
  }
29
31
  return result;
30
32
  }
33
+ /**
34
+ * Validate that a string is a valid UUID (v1–v5) format.
35
+ * @param uuid - The string to validate.
36
+ * @returns True if valid UUID, false otherwise.
37
+ */
38
+ function isValidUUID(uuid) {
39
+ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
40
+ return uuidRegex.test(uuid);
41
+ }
42
+ /**
43
+ * Validate UUID and throw error if invalid.
44
+ * @param uuid - The UUID to validate.
45
+ * @param paramName - The parameter name for error message.
46
+ * @throws {Error} If UUID is invalid.
47
+ */
48
+ function validateUUID(uuid, paramName = 'id') {
49
+ if (!isValidUUID(uuid)) {
50
+ throw new Error(`Invalid UUID format for ${paramName}: ${uuid}`);
51
+ }
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acontext/acontext",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "TypeScript SDK for the Acontext API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",