@acontext/acontext 0.0.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/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # acontext client for TypeScript
2
+
3
+ TypeScript SDK for interacting with the Acontext REST API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @acontext/acontext
9
+ ```
10
+
11
+ ## Quickstart
12
+
13
+ ```typescript
14
+ import { AcontextClient, MessagePart } from '@acontext/acontext';
15
+
16
+ const client = new AcontextClient({ apiKey: 'sk_project_token' });
17
+
18
+ // List spaces for the authenticated project
19
+ const spaces = await client.spaces.list();
20
+
21
+ // Create a session bound to the first space
22
+ const session = await client.sessions.create({ spaceId: spaces.items[0].id });
23
+
24
+ // Send a text message to the session
25
+ await client.sessions.sendMessage(
26
+ session.id,
27
+ {
28
+ role: 'user',
29
+ parts: [MessagePart.textPart('Hello from TypeScript!')],
30
+ },
31
+ { format: 'acontext' }
32
+ );
33
+ ```
34
+
35
+ See the inline documentation for the full list of helpers covering sessions, spaces, disks, and artifact uploads.
36
+
37
+ ## Managing disks and artifacts
38
+
39
+ Artifacts now live under project disks. Create a disk first, then upload files through the disk-scoped helper:
40
+
41
+ ```typescript
42
+ import { AcontextClient, FileUpload } from '@acontext/acontext';
43
+
44
+ const client = new AcontextClient({ apiKey: 'sk_project_token' });
45
+
46
+ const disk = await client.disks.create();
47
+ await client.disks.artifacts.upsert(
48
+ disk.id,
49
+ {
50
+ file: new FileUpload({
51
+ filename: 'retro_notes.md',
52
+ content: Buffer.from('# Retro Notes\nWe shipped file uploads successfully!\n'),
53
+ contentType: 'text/markdown',
54
+ }),
55
+ filePath: '/notes/',
56
+ meta: { source: 'readme-demo' },
57
+ }
58
+ );
59
+ ```
60
+
61
+ ## Working with blocks
62
+
63
+ ```typescript
64
+ import { AcontextClient } from '@acontext/acontext';
65
+
66
+ const client = new AcontextClient({ apiKey: 'sk_project_token' });
67
+
68
+ const space = await client.spaces.create();
69
+ const page = await client.blocks.create(space.id, {
70
+ blockType: 'page',
71
+ title: 'Kick-off Notes',
72
+ });
73
+ await client.blocks.create(space.id, {
74
+ parentId: page.id,
75
+ blockType: 'text',
76
+ title: 'First block',
77
+ props: { text: 'Plan the sprint goals' },
78
+ });
79
+ ```
80
+
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Common typing helpers used by resource modules to avoid circular imports.
3
+ */
4
+ export interface RequesterProtocol {
5
+ request<T = unknown>(method: string, path: string, options?: {
6
+ params?: Record<string, string | number>;
7
+ jsonData?: unknown;
8
+ data?: Record<string, string>;
9
+ files?: Record<string, {
10
+ filename: string;
11
+ content: Buffer | NodeJS.ReadableStream;
12
+ contentType: string;
13
+ }>;
14
+ unwrap?: boolean;
15
+ }): Promise<T>;
16
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * Common typing helpers used by resource modules to avoid circular imports.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,41 @@
1
+ /**
2
+ * High-level synchronous client for the Acontext API.
3
+ */
4
+ import { BlocksAPI } from './resources/blocks';
5
+ import { DisksAPI } from './resources/disks';
6
+ import { SessionsAPI } from './resources/sessions';
7
+ import { SpacesAPI } from './resources/spaces';
8
+ import { RequesterProtocol } from './client-types';
9
+ export interface AcontextClientOptions {
10
+ apiKey?: string | null;
11
+ baseUrl?: string | null;
12
+ timeout?: number | null;
13
+ userAgent?: string | null;
14
+ }
15
+ export declare class AcontextClient implements RequesterProtocol {
16
+ private _baseUrl;
17
+ private _apiKey;
18
+ private _timeout;
19
+ private _userAgent;
20
+ spaces: SpacesAPI;
21
+ sessions: SessionsAPI;
22
+ disks: DisksAPI;
23
+ artifacts: DisksAPI['artifacts'];
24
+ blocks: BlocksAPI;
25
+ constructor(options?: AcontextClientOptions);
26
+ get baseUrl(): string;
27
+ request<T = unknown>(method: string, path: string, options?: {
28
+ params?: Record<string, string | number>;
29
+ jsonData?: unknown;
30
+ data?: Record<string, string>;
31
+ files?: Record<string, {
32
+ filename: string;
33
+ content: Buffer | NodeJS.ReadableStream;
34
+ contentType: string;
35
+ }>;
36
+ unwrap?: boolean;
37
+ }): Promise<T>;
38
+ private handleResponse;
39
+ private getFetch;
40
+ private getFormData;
41
+ }
package/dist/client.js ADDED
@@ -0,0 +1,283 @@
1
+ "use strict";
2
+ /**
3
+ * High-level synchronous client for the Acontext API.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.AcontextClient = void 0;
40
+ const errors_1 = require("./errors");
41
+ const blocks_1 = require("./resources/blocks");
42
+ const disks_1 = require("./resources/disks");
43
+ const sessions_1 = require("./resources/sessions");
44
+ const spaces_1 = require("./resources/spaces");
45
+ const constants_1 = require("./constants");
46
+ class AcontextClient {
47
+ constructor(options = {}) {
48
+ // Priority: explicit parameters > environment variables > defaults
49
+ // Load apiKey from parameter or environment variable
50
+ this._apiKey =
51
+ options.apiKey ||
52
+ (typeof process !== 'undefined' && process.env?.ACONTEXT_API_KEY) ||
53
+ '';
54
+ if (!this._apiKey || !this._apiKey.trim()) {
55
+ throw new Error("apiKey is required. Provide it either as a parameter (apiKey='...') " +
56
+ "or set the ACONTEXT_API_KEY environment variable.");
57
+ }
58
+ // Load other parameters from environment variables if not provided
59
+ this._baseUrl =
60
+ options.baseUrl ||
61
+ (typeof process !== 'undefined' && process.env?.ACONTEXT_BASE_URL) ||
62
+ constants_1.DEFAULT_BASE_URL;
63
+ this._baseUrl = this._baseUrl.replace(/\/$/, '');
64
+ this._userAgent =
65
+ options.userAgent ||
66
+ (typeof process !== 'undefined' && process.env?.ACONTEXT_USER_AGENT) ||
67
+ constants_1.DEFAULT_USER_AGENT;
68
+ this._timeout =
69
+ options.timeout ??
70
+ (typeof process !== 'undefined' && process.env?.ACONTEXT_TIMEOUT
71
+ ? parseFloat(process.env.ACONTEXT_TIMEOUT)
72
+ : 10000);
73
+ this.spaces = new spaces_1.SpacesAPI(this);
74
+ this.sessions = new sessions_1.SessionsAPI(this);
75
+ this.disks = new disks_1.DisksAPI(this);
76
+ this.artifacts = this.disks.artifacts;
77
+ this.blocks = new blocks_1.BlocksAPI(this);
78
+ }
79
+ get baseUrl() {
80
+ return this._baseUrl;
81
+ }
82
+ async request(method, path, options) {
83
+ const unwrap = options?.unwrap !== false;
84
+ const url = `${this._baseUrl}${path}`;
85
+ try {
86
+ // Build headers
87
+ const headers = {
88
+ Authorization: `Bearer ${this._apiKey}`,
89
+ Accept: 'application/json',
90
+ 'User-Agent': this._userAgent,
91
+ };
92
+ // Build request options
93
+ let body;
94
+ let requestHeaders = headers;
95
+ if (options?.files) {
96
+ // Use FormData for file uploads
97
+ const FormDataClass = await this.getFormData();
98
+ const formData = new FormDataClass();
99
+ // Add regular form fields
100
+ if (options.data) {
101
+ for (const [key, value] of Object.entries(options.data)) {
102
+ formData.append(key, value);
103
+ }
104
+ }
105
+ // Add files
106
+ for (const [key, file] of Object.entries(options.files)) {
107
+ // Handle Buffer: convert to Blob in browser, use directly in Node.js
108
+ if (file.content instanceof Buffer) {
109
+ // Check if we're in a browser environment (has Blob constructor)
110
+ if (typeof Blob !== 'undefined') {
111
+ // Browser environment: convert Buffer to Blob via Uint8Array
112
+ const uint8Array = new Uint8Array(file.content);
113
+ const blob = new Blob([uint8Array], { type: file.contentType });
114
+ formData.append(key, blob, file.filename);
115
+ }
116
+ else {
117
+ // Node.js environment: form-data package accepts Buffer directly
118
+ // form-data's append signature differs from browser FormData
119
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
120
+ formData.append(key, file.content, {
121
+ filename: file.filename,
122
+ contentType: file.contentType,
123
+ });
124
+ }
125
+ }
126
+ else {
127
+ // ReadableStream: pass as-is (form-data handles it)
128
+ // form-data's append signature differs from browser FormData
129
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
+ formData.append(key, file.content, {
131
+ filename: file.filename,
132
+ contentType: file.contentType,
133
+ });
134
+ }
135
+ }
136
+ // FormData type differs between browser and Node.js (form-data package)
137
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
138
+ body = formData;
139
+ // Don't set Content-Type for FormData, let the browser/Node set it with boundary
140
+ delete requestHeaders['Content-Type'];
141
+ }
142
+ else if (options?.jsonData) {
143
+ body = JSON.stringify(options.jsonData);
144
+ requestHeaders['Content-Type'] = 'application/json';
145
+ }
146
+ else if (options?.data) {
147
+ // For URL-encoded form data
148
+ const FormDataClass = await this.getFormData();
149
+ const formData = new FormDataClass();
150
+ for (const [key, value] of Object.entries(options.data)) {
151
+ formData.append(key, value);
152
+ }
153
+ // FormData type differs between browser and Node.js (form-data package)
154
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
155
+ body = formData;
156
+ delete requestHeaders['Content-Type'];
157
+ }
158
+ // Build URL with query parameters
159
+ let finalUrl = url;
160
+ if (options?.params && Object.keys(options.params).length > 0) {
161
+ const searchParams = new URLSearchParams();
162
+ for (const [key, value] of Object.entries(options.params)) {
163
+ searchParams.append(key, String(value));
164
+ }
165
+ finalUrl = `${url}?${searchParams.toString()}`;
166
+ }
167
+ // Make the request
168
+ const fetchImpl = await this.getFetch();
169
+ const controller = new AbortController();
170
+ const timeoutId = setTimeout(() => controller.abort(), this._timeout);
171
+ try {
172
+ const response = await fetchImpl(finalUrl, {
173
+ method,
174
+ headers: requestHeaders,
175
+ body,
176
+ signal: controller.signal,
177
+ });
178
+ clearTimeout(timeoutId);
179
+ return await this.handleResponse(response, unwrap);
180
+ }
181
+ catch (error) {
182
+ clearTimeout(timeoutId);
183
+ if (error instanceof Error && error.name === 'AbortError') {
184
+ throw new errors_1.TransportError(`Request timeout after ${this._timeout}ms`);
185
+ }
186
+ throw error;
187
+ }
188
+ }
189
+ catch (error) {
190
+ if (error instanceof errors_1.APIError || error instanceof errors_1.TransportError) {
191
+ throw error;
192
+ }
193
+ throw new errors_1.TransportError(error instanceof Error ? error.message : String(error));
194
+ }
195
+ }
196
+ async handleResponse(response, unwrap) {
197
+ const contentType = response.headers.get('content-type') || '';
198
+ let parsed = null;
199
+ if (contentType.includes('application/json')) {
200
+ try {
201
+ parsed = await response.json();
202
+ }
203
+ catch {
204
+ parsed = null;
205
+ }
206
+ }
207
+ if (response.status >= 400) {
208
+ const payload = parsed;
209
+ let message = response.statusText;
210
+ let code;
211
+ let error;
212
+ if (payload && typeof payload === 'object') {
213
+ message = String(payload.msg || payload.message || message);
214
+ error = payload.error;
215
+ const codeVal = payload.code;
216
+ if (typeof codeVal === 'number') {
217
+ code = codeVal;
218
+ }
219
+ }
220
+ throw new errors_1.APIError({
221
+ statusCode: response.status,
222
+ code,
223
+ message,
224
+ error,
225
+ payload,
226
+ });
227
+ }
228
+ if (parsed === null) {
229
+ if (unwrap) {
230
+ return (await response.text());
231
+ }
232
+ return {
233
+ code: response.status,
234
+ data: await response.text(),
235
+ msg: response.statusText,
236
+ };
237
+ }
238
+ const payload = parsed;
239
+ const appCode = payload.code;
240
+ if (typeof appCode === 'number' && appCode >= 400) {
241
+ throw new errors_1.APIError({
242
+ statusCode: response.status,
243
+ code: appCode,
244
+ message: String(payload.msg || response.statusText),
245
+ error: payload.error,
246
+ payload,
247
+ });
248
+ }
249
+ return (unwrap ? payload.data : payload);
250
+ }
251
+ async getFetch() {
252
+ // Try to use global fetch if available (Node 18+, modern browsers)
253
+ if (typeof fetch !== 'undefined') {
254
+ return fetch;
255
+ }
256
+ // Fallback to node-fetch for older Node versions
257
+ try {
258
+ // node-fetch is an optional peer dependency, use dynamic import with type assertion
259
+ const nodeFetch = await Promise.resolve(`${'node-fetch'}`).then(s => __importStar(require(s)));
260
+ return nodeFetch.default;
261
+ }
262
+ catch {
263
+ throw new Error('fetch is not available. Please use Node.js 18+ or install node-fetch');
264
+ }
265
+ }
266
+ async getFormData() {
267
+ // Try to use global FormData if available
268
+ if (typeof FormData !== 'undefined') {
269
+ return FormData;
270
+ }
271
+ // Fallback to form-data for older Node versions
272
+ try {
273
+ // form-data is an optional peer dependency, use dynamic import with type assertion
274
+ const FormDataModule = await Promise.resolve(`${'form-data'}`).then(s => __importStar(require(s)));
275
+ // form-data package has different API than browser FormData, but compatible enough
276
+ return FormDataModule.default;
277
+ }
278
+ catch {
279
+ throw new Error('FormData is not available. Please use Node.js 18+ or install form-data');
280
+ }
281
+ }
282
+ }
283
+ exports.AcontextClient = AcontextClient;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Internal constants shared across the TypeScript SDK.
3
+ */
4
+ export declare const DEFAULT_BASE_URL = "https://api.acontext.io/api/v1";
5
+ export declare const DEFAULT_USER_AGENT = "acontext-ts/0.0.1";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * Internal constants shared across the TypeScript SDK.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DEFAULT_USER_AGENT = exports.DEFAULT_BASE_URL = void 0;
7
+ exports.DEFAULT_BASE_URL = 'https://api.acontext.io/api/v1';
8
+ exports.DEFAULT_USER_AGENT = 'acontext-ts/0.0.1';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Custom exceptions raised by the acontext TypeScript client.
3
+ */
4
+ /**
5
+ * Base exception for all errors raised by `acontext`.
6
+ */
7
+ export declare class AcontextError extends Error {
8
+ constructor(message: string);
9
+ }
10
+ /**
11
+ * Raised when the server returns an error response.
12
+ */
13
+ export declare class APIError extends AcontextError {
14
+ statusCode: number;
15
+ code?: number;
16
+ message: string;
17
+ error?: string;
18
+ payload?: unknown;
19
+ constructor(options: {
20
+ statusCode: number;
21
+ code?: number;
22
+ message?: string;
23
+ error?: string;
24
+ payload?: unknown;
25
+ });
26
+ }
27
+ /**
28
+ * Raised when the underlying HTTP transport failed before receiving a response.
29
+ */
30
+ export declare class TransportError extends AcontextError {
31
+ constructor(message: string);
32
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ /**
3
+ * Custom exceptions raised by the acontext TypeScript client.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TransportError = exports.APIError = exports.AcontextError = void 0;
7
+ /**
8
+ * Base exception for all errors raised by `acontext`.
9
+ */
10
+ class AcontextError extends Error {
11
+ constructor(message) {
12
+ super(message);
13
+ this.name = 'AcontextError';
14
+ Object.setPrototypeOf(this, AcontextError.prototype);
15
+ }
16
+ }
17
+ exports.AcontextError = AcontextError;
18
+ /**
19
+ * Raised when the server returns an error response.
20
+ */
21
+ class APIError extends AcontextError {
22
+ constructor(options) {
23
+ const details = options.message || options.error || 'API request failed';
24
+ super(`${options.statusCode}: ${details}`);
25
+ this.name = 'APIError';
26
+ this.statusCode = options.statusCode;
27
+ this.code = options.code;
28
+ this.message = details;
29
+ this.error = options.error;
30
+ this.payload = options.payload;
31
+ Object.setPrototypeOf(this, APIError.prototype);
32
+ }
33
+ }
34
+ exports.APIError = APIError;
35
+ /**
36
+ * Raised when the underlying HTTP transport failed before receiving a response.
37
+ */
38
+ class TransportError extends AcontextError {
39
+ constructor(message) {
40
+ super(message);
41
+ this.name = 'TransportError';
42
+ Object.setPrototypeOf(this, TransportError.prototype);
43
+ }
44
+ }
45
+ exports.TransportError = TransportError;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * TypeScript SDK for the Acontext API.
3
+ */
4
+ export { AcontextClient } from './client';
5
+ export type { AcontextClientOptions } from './client';
6
+ export { FileUpload } from './uploads';
7
+ export { MessagePart, AcontextMessage, buildAcontextMessage } from './messages';
8
+ export { APIError, TransportError, AcontextError } from './errors';
9
+ export * from './types';
10
+ export * from './resources';
package/dist/index.js ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * TypeScript SDK for the Acontext API.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.AcontextError = exports.TransportError = exports.APIError = exports.buildAcontextMessage = exports.AcontextMessage = exports.MessagePart = exports.FileUpload = exports.AcontextClient = void 0;
21
+ var client_1 = require("./client");
22
+ Object.defineProperty(exports, "AcontextClient", { enumerable: true, get: function () { return client_1.AcontextClient; } });
23
+ var uploads_1 = require("./uploads");
24
+ Object.defineProperty(exports, "FileUpload", { enumerable: true, get: function () { return uploads_1.FileUpload; } });
25
+ var messages_1 = require("./messages");
26
+ Object.defineProperty(exports, "MessagePart", { enumerable: true, get: function () { return messages_1.MessagePart; } });
27
+ Object.defineProperty(exports, "AcontextMessage", { enumerable: true, get: function () { return messages_1.AcontextMessage; } });
28
+ Object.defineProperty(exports, "buildAcontextMessage", { enumerable: true, get: function () { return messages_1.buildAcontextMessage; } });
29
+ var errors_1 = require("./errors");
30
+ Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return errors_1.APIError; } });
31
+ Object.defineProperty(exports, "TransportError", { enumerable: true, get: function () { return errors_1.TransportError; } });
32
+ Object.defineProperty(exports, "AcontextError", { enumerable: true, get: function () { return errors_1.AcontextError; } });
33
+ __exportStar(require("./types"), exports);
34
+ __exportStar(require("./resources"), exports);
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Support for constructing session messages.
3
+ */
4
+ import { z } from 'zod';
5
+ export declare const MessagePartSchema: z.ZodObject<{
6
+ type: z.ZodString;
7
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
9
+ file_field: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
+ }, z.core.$strip>;
11
+ export type MessagePartInput = z.infer<typeof MessagePartSchema>;
12
+ export declare class MessagePart {
13
+ type: string;
14
+ text?: string | null;
15
+ meta?: Record<string, unknown> | null;
16
+ file_field?: string | null;
17
+ constructor(data: MessagePartInput);
18
+ static textPart(text: string, options?: {
19
+ meta?: Record<string, unknown> | null;
20
+ }): MessagePart;
21
+ static fileFieldPart(fileField: string, options?: {
22
+ meta?: Record<string, unknown> | null;
23
+ }): MessagePart;
24
+ toJSON(): MessagePartInput;
25
+ }
26
+ export declare const AcontextMessageSchema: z.ZodObject<{
27
+ role: z.ZodEnum<{
28
+ user: "user";
29
+ assistant: "assistant";
30
+ system: "system";
31
+ }>;
32
+ parts: z.ZodArray<z.ZodObject<{
33
+ type: z.ZodString;
34
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
+ meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
36
+ file_field: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ }, z.core.$strip>>;
38
+ meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
39
+ }, z.core.$strip>;
40
+ export type AcontextMessageInput = z.infer<typeof AcontextMessageSchema>;
41
+ export declare class AcontextMessage {
42
+ role: 'user' | 'assistant' | 'system';
43
+ parts: MessagePart[];
44
+ meta?: Record<string, unknown> | null;
45
+ constructor(data: AcontextMessageInput);
46
+ toJSON(): AcontextMessageInput;
47
+ }
48
+ export declare function buildAcontextMessage(options: {
49
+ role: 'user' | 'assistant' | 'system';
50
+ parts: (MessagePart | string | MessagePartInput)[];
51
+ meta?: Record<string, unknown> | null;
52
+ }): AcontextMessage;