@acontext/acontext 0.0.2 → 0.0.3

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
@@ -37,6 +37,25 @@ await client.sessions.flush(session.id);
37
37
 
38
38
  See the inline documentation for the full list of helpers covering sessions, spaces, disks, and artifact uploads.
39
39
 
40
+ ## Health Check
41
+
42
+ Test connectivity to the Acontext API server:
43
+
44
+ ```typescript
45
+ import { AcontextClient } from '@acontext/acontext';
46
+
47
+ const client = new AcontextClient({ apiKey: 'sk-ac-your-root-api-bearer-token' });
48
+
49
+ // Ping the server
50
+ const pong = await client.ping();
51
+ console.log(`Server responded: ${pong}`); // Output: Server responded: pong
52
+ ```
53
+
54
+ This is useful for:
55
+ - Verifying API connectivity before performing operations
56
+ - Health checks in monitoring systems
57
+ - Debugging connection issues
58
+
40
59
  ## Managing disks and artifacts
41
60
 
42
61
  Artifacts now live under project disks. Create a disk first, then upload files through the disk-scoped helper:
@@ -156,7 +175,7 @@ if (result.final_answer) {
156
175
  }
157
176
  ```
158
177
 
159
- ### 2. Semantic Global (Search page/folder titles)
178
+ ### 2. Semantic Glob (Search page/folder titles)
160
179
 
161
180
  Search for pages and folders by their titles using semantic similarity (like a semantic version of `glob`):
162
181
 
package/dist/client.d.ts CHANGED
@@ -26,6 +26,14 @@ export declare class AcontextClient implements RequesterProtocol {
26
26
  tools: ToolsAPI;
27
27
  constructor(options?: AcontextClientOptions);
28
28
  get baseUrl(): string;
29
+ /**
30
+ * Ping the API server to check connectivity.
31
+ *
32
+ * @returns Promise resolving to "pong" if the server is reachable and responding.
33
+ * @throws {APIError} If the server returns an error response.
34
+ * @throws {TransportError} If there's a network connectivity issue.
35
+ */
36
+ ping(): Promise<string>;
29
37
  request<T = unknown>(method: string, path: string, options?: {
30
38
  params?: Record<string, string | number>;
31
39
  jsonData?: unknown;
package/dist/client.js CHANGED
@@ -81,6 +81,19 @@ class AcontextClient {
81
81
  get baseUrl() {
82
82
  return this._baseUrl;
83
83
  }
84
+ /**
85
+ * Ping the API server to check connectivity.
86
+ *
87
+ * @returns Promise resolving to "pong" if the server is reachable and responding.
88
+ * @throws {APIError} If the server returns an error response.
89
+ * @throws {TransportError} If there's a network connectivity issue.
90
+ */
91
+ async ping() {
92
+ const response = await this.request('GET', '/ping', {
93
+ unwrap: false,
94
+ });
95
+ return response.msg || 'pong';
96
+ }
84
97
  async request(method, path, options) {
85
98
  const unwrap = options?.unwrap !== false;
86
99
  const url = `${this._baseUrl}${path}`;
@@ -124,7 +124,7 @@ class SessionsAPI {
124
124
  limit: options?.limit ?? null,
125
125
  cursor: options?.cursor ?? null,
126
126
  with_asset_public_url: options?.withAssetPublicUrl ?? null,
127
- time_desc: options?.timeDesc ?? null,
127
+ time_desc: options?.timeDesc ?? true, // Default to true
128
128
  }));
129
129
  const data = await this.requester.request('GET', `/session/${sessionId}/messages`, {
130
130
  params: Object.keys(params).length > 0 ? params : undefined,
@@ -38,7 +38,7 @@ export declare class SpacesAPI {
38
38
  maxIterations?: number | null;
39
39
  }): Promise<SpaceSearchResult>;
40
40
  /**
41
- * Perform semantic global (glob) search for page/folder titles.
41
+ * Perform semantic glob (glob) search for page/folder titles.
42
42
  *
43
43
  * Searches specifically for page/folder titles using semantic similarity,
44
44
  * similar to a semantic version of the glob command.
@@ -67,7 +67,7 @@ class SpacesAPI {
67
67
  return types_1.SpaceSearchResultSchema.parse(data);
68
68
  }
69
69
  /**
70
- * Perform semantic global (glob) search for page/folder titles.
70
+ * Perform semantic glob (glob) search for page/folder titles.
71
71
  *
72
72
  * Searches specifically for page/folder titles using semantic similarity,
73
73
  * similar to a semantic version of the glob command.
@@ -82,7 +82,7 @@ class SpacesAPI {
82
82
  limit: options.limit ?? null,
83
83
  threshold: options.threshold ?? null,
84
84
  });
85
- const data = await this.requester.request('GET', `/space/${spaceId}/semantic_global`, { params: Object.keys(params).length > 0 ? params : undefined });
85
+ const data = await this.requester.request('GET', `/space/${spaceId}/semantic_glob`, { params: Object.keys(params).length > 0 ? params : undefined });
86
86
  return data.map((item) => types_1.SearchResultBlockItemSchema.parse(item));
87
87
  }
88
88
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acontext/acontext",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "TypeScript SDK for the Acontext API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",