@acontext/acontext 0.0.1 → 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
@@ -1,4 +1,4 @@
1
- # acontext client for TypeScript
1
+ # Acontext client for TypeScript
2
2
 
3
3
  TypeScript SDK for interacting with the Acontext REST API.
4
4
 
@@ -13,7 +13,7 @@ npm install @acontext/acontext
13
13
  ```typescript
14
14
  import { AcontextClient, MessagePart } from '@acontext/acontext';
15
15
 
16
- const client = new AcontextClient({ apiKey: 'sk_project_token' });
16
+ const client = new AcontextClient({ apiKey: 'sk-ac-your-root-api-bearer-token' });
17
17
 
18
18
  // List spaces for the authenticated project
19
19
  const spaces = await client.spaces.list();
@@ -30,10 +30,32 @@ await client.sessions.sendMessage(
30
30
  },
31
31
  { format: 'acontext' }
32
32
  );
33
+
34
+ // Flush session buffer when needed
35
+ await client.sessions.flush(session.id);
33
36
  ```
34
37
 
35
38
  See the inline documentation for the full list of helpers covering sessions, spaces, disks, and artifact uploads.
36
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
+
37
59
  ## Managing disks and artifacts
38
60
 
39
61
  Artifacts now live under project disks. Create a disk first, then upload files through the disk-scoped helper:
@@ -41,7 +63,7 @@ Artifacts now live under project disks. Create a disk first, then upload files t
41
63
  ```typescript
42
64
  import { AcontextClient, FileUpload } from '@acontext/acontext';
43
65
 
44
- const client = new AcontextClient({ apiKey: 'sk_project_token' });
66
+ const client = new AcontextClient({ apiKey: 'sk-ac-your-root-api-bearer-token' });
45
67
 
46
68
  const disk = await client.disks.create();
47
69
  await client.disks.artifacts.upsert(
@@ -63,7 +85,7 @@ await client.disks.artifacts.upsert(
63
85
  ```typescript
64
86
  import { AcontextClient } from '@acontext/acontext';
65
87
 
66
- const client = new AcontextClient({ apiKey: 'sk_project_token' });
88
+ const client = new AcontextClient({ apiKey: 'sk-ac-your-root-api-bearer-token' });
67
89
 
68
90
  const space = await client.spaces.create();
69
91
  const page = await client.blocks.create(space.id, {
@@ -78,3 +100,116 @@ await client.blocks.create(space.id, {
78
100
  });
79
101
  ```
80
102
 
103
+ ## Managing sessions
104
+
105
+ ### Flush session buffer
106
+
107
+ The `flush` method clears the session buffer, useful for managing session state:
108
+
109
+ ```typescript
110
+ const result = await client.sessions.flush('session-uuid');
111
+ console.log(result); // { status: 0, errmsg: '' }
112
+ ```
113
+
114
+ ## Working with tools
115
+
116
+ The SDK provides APIs to manage tool names within your project:
117
+
118
+ ### Get tool names
119
+
120
+ ```typescript
121
+ const tools = await client.tools.getToolName();
122
+ for (const tool of tools) {
123
+ console.log(`${tool.name} (used in ${tool.sop_count} SOPs)`);
124
+ }
125
+ ```
126
+
127
+ ### Rename tool names
128
+
129
+ ```typescript
130
+ const result = await client.tools.renameToolName({
131
+ rename: [
132
+ { oldName: 'calculate', newName: 'calculate_math' },
133
+ { oldName: 'search', newName: 'search_web' },
134
+ ],
135
+ });
136
+ console.log(result); // { status: 0, errmsg: '' }
137
+ ```
138
+
139
+ ## Semantic search within spaces
140
+
141
+ The SDK provides three powerful semantic search APIs for finding content within your spaces:
142
+
143
+ ### 1. Experience Search (Advanced AI-powered search)
144
+
145
+ The most sophisticated search that can operate in two modes: **fast** (quick semantic search) or **agentic** (AI-powered iterative refinement).
146
+
147
+ ```typescript
148
+ import { AcontextClient } from '@acontext/acontext';
149
+
150
+ const client = new AcontextClient({ apiKey: 'sk_project_token' });
151
+
152
+ // Fast mode - quick semantic search
153
+ const result = await client.spaces.experienceSearch('space-uuid', {
154
+ query: 'How to implement authentication?',
155
+ limit: 10,
156
+ mode: 'fast',
157
+ semanticThreshold: 0.8,
158
+ });
159
+
160
+ // Agentic mode - AI-powered iterative search
161
+ const agenticResult = await client.spaces.experienceSearch('space-uuid', {
162
+ query: 'What are the best practices for API security?',
163
+ limit: 10,
164
+ mode: 'agentic',
165
+ maxIterations: 20,
166
+ });
167
+
168
+ // Access results
169
+ for (const block of result.cited_blocks) {
170
+ console.log(`${block.title} (distance: ${block.distance})`);
171
+ }
172
+
173
+ if (result.final_answer) {
174
+ console.log(`AI Answer: ${result.final_answer}`);
175
+ }
176
+ ```
177
+
178
+ ### 2. Semantic Glob (Search page/folder titles)
179
+
180
+ Search for pages and folders by their titles using semantic similarity (like a semantic version of `glob`):
181
+
182
+ ```typescript
183
+ // Find pages about authentication
184
+ const results = await client.spaces.semanticGlobal('space-uuid', {
185
+ query: 'authentication and authorization pages',
186
+ limit: 10,
187
+ threshold: 1.0, // Only show results with distance < 1.0
188
+ });
189
+
190
+ for (const block of results) {
191
+ console.log(`${block.title} - ${block.type}`);
192
+ }
193
+ ```
194
+
195
+ ### 3. Semantic Grep (Search content blocks)
196
+
197
+ Search through actual content blocks using semantic similarity (like a semantic version of `grep`):
198
+
199
+ ```typescript
200
+ // Find code examples for JWT validation
201
+ const results = await client.spaces.semanticGrep('space-uuid', {
202
+ query: 'JWT token validation code examples',
203
+ limit: 15,
204
+ threshold: 0.7,
205
+ });
206
+
207
+ for (const block of results) {
208
+ console.log(`${block.title} - distance: ${block.distance}`);
209
+ const content = block.props.text || block.props.content;
210
+ if (content) {
211
+ console.log(`Content: ${String(content).substring(0, 100)}...`);
212
+ }
213
+ }
214
+ ```
215
+
package/dist/client.d.ts CHANGED
@@ -5,6 +5,7 @@ import { BlocksAPI } from './resources/blocks';
5
5
  import { DisksAPI } from './resources/disks';
6
6
  import { SessionsAPI } from './resources/sessions';
7
7
  import { SpacesAPI } from './resources/spaces';
8
+ import { ToolsAPI } from './resources/tools';
8
9
  import { RequesterProtocol } from './client-types';
9
10
  export interface AcontextClientOptions {
10
11
  apiKey?: string | null;
@@ -22,8 +23,17 @@ export declare class AcontextClient implements RequesterProtocol {
22
23
  disks: DisksAPI;
23
24
  artifacts: DisksAPI['artifacts'];
24
25
  blocks: BlocksAPI;
26
+ tools: ToolsAPI;
25
27
  constructor(options?: AcontextClientOptions);
26
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>;
27
37
  request<T = unknown>(method: string, path: string, options?: {
28
38
  params?: Record<string, string | number>;
29
39
  jsonData?: unknown;
package/dist/client.js CHANGED
@@ -42,6 +42,7 @@ const blocks_1 = require("./resources/blocks");
42
42
  const disks_1 = require("./resources/disks");
43
43
  const sessions_1 = require("./resources/sessions");
44
44
  const spaces_1 = require("./resources/spaces");
45
+ const tools_1 = require("./resources/tools");
45
46
  const constants_1 = require("./constants");
46
47
  class AcontextClient {
47
48
  constructor(options = {}) {
@@ -75,10 +76,24 @@ class AcontextClient {
75
76
  this.disks = new disks_1.DisksAPI(this);
76
77
  this.artifacts = this.disks.artifacts;
77
78
  this.blocks = new blocks_1.BlocksAPI(this);
79
+ this.tools = new tools_1.ToolsAPI(this);
78
80
  }
79
81
  get baseUrl() {
80
82
  return this._baseUrl;
81
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
+ }
82
97
  async request(method, path, options) {
83
98
  const unwrap = options?.unwrap !== false;
84
99
  const url = `${this._baseUrl}${path}`;
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { RequesterProtocol } from '../client-types';
5
5
  import { Block } from '../types';
6
+ import { InsertBlockResponse } from '../types/tool';
6
7
  export declare class BlocksAPI {
7
8
  private requester;
8
9
  constructor(requester: RequesterProtocol);
@@ -15,7 +16,7 @@ export declare class BlocksAPI {
15
16
  parentId?: string | null;
16
17
  title?: string | null;
17
18
  props?: Record<string, unknown> | null;
18
- }): Promise<Block>;
19
+ }): Promise<InsertBlockResponse>;
19
20
  delete(spaceId: string, blockId: string): Promise<void>;
20
21
  getProperties(spaceId: string, blockId: string): Promise<Block>;
21
22
  updateProperties(spaceId: string, blockId: string, options: {
@@ -5,6 +5,7 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BlocksAPI = void 0;
7
7
  const types_1 = require("../types");
8
+ const tool_1 = require("../types/tool");
8
9
  class BlocksAPI {
9
10
  constructor(requester) {
10
11
  this.requester = requester;
@@ -36,7 +37,7 @@ class BlocksAPI {
36
37
  const data = await this.requester.request('POST', `/space/${spaceId}/block`, {
37
38
  jsonData: payload,
38
39
  });
39
- return types_1.BlockSchema.parse(data);
40
+ return tool_1.InsertBlockResponseSchema.parse(data);
40
41
  }
41
42
  async delete(spaceId, blockId) {
42
43
  await this.requester.request('DELETE', `/space/${spaceId}/block/${blockId}`);
@@ -5,3 +5,4 @@ export * from './spaces';
5
5
  export * from './sessions';
6
6
  export * from './disks';
7
7
  export * from './blocks';
8
+ export * from './tools';
@@ -21,3 +21,4 @@ __exportStar(require("./spaces"), exports);
21
21
  __exportStar(require("./sessions"), exports);
22
22
  __exportStar(require("./disks"), exports);
23
23
  __exportStar(require("./blocks"), exports);
24
+ __exportStar(require("./tools"), exports);
@@ -45,4 +45,8 @@ export declare class SessionsAPI {
45
45
  format?: 'acontext' | 'openai' | 'anthropic';
46
46
  timeDesc?: boolean | null;
47
47
  }): Promise<GetMessagesOutput>;
48
+ flush(sessionId: string): Promise<{
49
+ status: number;
50
+ errmsg: string;
51
+ }>;
48
52
  }
@@ -124,12 +124,16 @@ 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,
131
131
  });
132
132
  return types_1.GetMessagesOutputSchema.parse(data);
133
133
  }
134
+ async flush(sessionId) {
135
+ const data = await this.requester.request('POST', `/session/${sessionId}/flush`);
136
+ return data;
137
+ }
134
138
  }
135
139
  exports.SessionsAPI = SessionsAPI;
@@ -2,7 +2,7 @@
2
2
  * Spaces endpoints.
3
3
  */
4
4
  import { RequesterProtocol } from '../client-types';
5
- import { ListSpacesOutput, Space } from '../types';
5
+ import { ListSpacesOutput, SearchResultBlockItem, Space, SpaceSearchResult } from '../types';
6
6
  export declare class SpacesAPI {
7
7
  private requester;
8
8
  constructor(requester: RequesterProtocol);
@@ -19,4 +19,52 @@ export declare class SpacesAPI {
19
19
  configs: Record<string, unknown>;
20
20
  }): Promise<void>;
21
21
  getConfigs(spaceId: string): Promise<Space>;
22
+ /**
23
+ * Perform experience search within a space.
24
+ *
25
+ * This is the most advanced search option that can operate in two modes:
26
+ * - fast: Quick semantic search (default)
27
+ * - agentic: Iterative search with AI-powered refinement
28
+ *
29
+ * @param spaceId - The UUID of the space
30
+ * @param options - Search options
31
+ * @returns SpaceSearchResult containing cited blocks and optional final answer
32
+ */
33
+ experienceSearch(spaceId: string, options: {
34
+ query: string;
35
+ limit?: number | null;
36
+ mode?: 'fast' | 'agentic' | null;
37
+ semanticThreshold?: number | null;
38
+ maxIterations?: number | null;
39
+ }): Promise<SpaceSearchResult>;
40
+ /**
41
+ * Perform semantic glob (glob) search for page/folder titles.
42
+ *
43
+ * Searches specifically for page/folder titles using semantic similarity,
44
+ * similar to a semantic version of the glob command.
45
+ *
46
+ * @param spaceId - The UUID of the space
47
+ * @param options - Search options
48
+ * @returns List of SearchResultBlockItem objects matching the query
49
+ */
50
+ semanticGlobal(spaceId: string, options: {
51
+ query: string;
52
+ limit?: number | null;
53
+ threshold?: number | null;
54
+ }): Promise<SearchResultBlockItem[]>;
55
+ /**
56
+ * Perform semantic grep search for content blocks.
57
+ *
58
+ * Searches through content blocks (actual text content) using semantic similarity,
59
+ * similar to a semantic version of the grep command.
60
+ *
61
+ * @param spaceId - The UUID of the space
62
+ * @param options - Search options
63
+ * @returns List of SearchResultBlockItem objects matching the query
64
+ */
65
+ semanticGrep(spaceId: string, options: {
66
+ query: string;
67
+ limit?: number | null;
68
+ threshold?: number | null;
69
+ }): Promise<SearchResultBlockItem[]>;
22
70
  }
@@ -44,5 +44,65 @@ class SpacesAPI {
44
44
  const data = await this.requester.request('GET', `/space/${spaceId}/configs`);
45
45
  return types_1.SpaceSchema.parse(data);
46
46
  }
47
+ /**
48
+ * Perform experience search within a space.
49
+ *
50
+ * This is the most advanced search option that can operate in two modes:
51
+ * - fast: Quick semantic search (default)
52
+ * - agentic: Iterative search with AI-powered refinement
53
+ *
54
+ * @param spaceId - The UUID of the space
55
+ * @param options - Search options
56
+ * @returns SpaceSearchResult containing cited blocks and optional final answer
57
+ */
58
+ async experienceSearch(spaceId, options) {
59
+ const params = (0, utils_1.buildParams)({
60
+ query: options.query,
61
+ limit: options.limit ?? null,
62
+ mode: options.mode ?? null,
63
+ semantic_threshold: options.semanticThreshold ?? null,
64
+ max_iterations: options.maxIterations ?? null,
65
+ });
66
+ const data = await this.requester.request('GET', `/space/${spaceId}/experience_search`, { params: Object.keys(params).length > 0 ? params : undefined });
67
+ return types_1.SpaceSearchResultSchema.parse(data);
68
+ }
69
+ /**
70
+ * Perform semantic glob (glob) search for page/folder titles.
71
+ *
72
+ * Searches specifically for page/folder titles using semantic similarity,
73
+ * similar to a semantic version of the glob command.
74
+ *
75
+ * @param spaceId - The UUID of the space
76
+ * @param options - Search options
77
+ * @returns List of SearchResultBlockItem objects matching the query
78
+ */
79
+ async semanticGlobal(spaceId, options) {
80
+ const params = (0, utils_1.buildParams)({
81
+ query: options.query,
82
+ limit: options.limit ?? null,
83
+ threshold: options.threshold ?? null,
84
+ });
85
+ const data = await this.requester.request('GET', `/space/${spaceId}/semantic_glob`, { params: Object.keys(params).length > 0 ? params : undefined });
86
+ return data.map((item) => types_1.SearchResultBlockItemSchema.parse(item));
87
+ }
88
+ /**
89
+ * Perform semantic grep search for content blocks.
90
+ *
91
+ * Searches through content blocks (actual text content) using semantic similarity,
92
+ * similar to a semantic version of the grep command.
93
+ *
94
+ * @param spaceId - The UUID of the space
95
+ * @param options - Search options
96
+ * @returns List of SearchResultBlockItem objects matching the query
97
+ */
98
+ async semanticGrep(spaceId, options) {
99
+ const params = (0, utils_1.buildParams)({
100
+ query: options.query,
101
+ limit: options.limit ?? null,
102
+ threshold: options.threshold ?? null,
103
+ });
104
+ const data = await this.requester.request('GET', `/space/${spaceId}/semantic_grep`, { params: Object.keys(params).length > 0 ? params : undefined });
105
+ return data.map((item) => types_1.SearchResultBlockItemSchema.parse(item));
106
+ }
47
107
  }
48
108
  exports.SpacesAPI = SpacesAPI;
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,26 @@
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;
@@ -5,3 +5,4 @@ export * from './space';
5
5
  export * from './session';
6
6
  export * from './disk';
7
7
  export * from './block';
8
+ export * from './tool';
@@ -21,3 +21,4 @@ __exportStar(require("./space"), exports);
21
21
  __exportStar(require("./session"), exports);
22
22
  __exportStar(require("./disk"), exports);
23
23
  __exportStar(require("./block"), exports);
24
+ __exportStar(require("./tool"), exports);
@@ -56,7 +56,7 @@ export declare const SessionSchema: z.ZodObject<{
56
56
  id: z.ZodString;
57
57
  project_id: z.ZodString;
58
58
  space_id: z.ZodNullable<z.ZodString>;
59
- configs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
59
+ configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
60
60
  created_at: z.ZodString;
61
61
  updated_at: z.ZodString;
62
62
  }, z.core.$strip>;
@@ -79,7 +79,7 @@ export declare const ListSessionsOutputSchema: z.ZodObject<{
79
79
  id: z.ZodString;
80
80
  project_id: z.ZodString;
81
81
  space_id: z.ZodNullable<z.ZodString>;
82
- configs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
82
+ configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
83
83
  created_at: z.ZodString;
84
84
  updated_at: z.ZodString;
85
85
  }, z.core.$strip>>;
@@ -36,7 +36,7 @@ exports.SessionSchema = zod_1.z.object({
36
36
  id: zod_1.z.string(),
37
37
  project_id: zod_1.z.string(),
38
38
  space_id: zod_1.z.string().nullable(),
39
- configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
39
+ configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable(),
40
40
  created_at: zod_1.z.string(),
41
41
  updated_at: zod_1.z.string(),
42
42
  });
@@ -5,7 +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
- configs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
8
+ configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
9
9
  created_at: z.ZodString;
10
10
  updated_at: z.ZodString;
11
11
  }, z.core.$strip>;
@@ -14,7 +14,7 @@ export declare const ListSpacesOutputSchema: z.ZodObject<{
14
14
  items: z.ZodArray<z.ZodObject<{
15
15
  id: z.ZodString;
16
16
  project_id: z.ZodString;
17
- configs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
17
+ configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
18
18
  created_at: z.ZodString;
19
19
  updated_at: z.ZodString;
20
20
  }, z.core.$strip>>;
@@ -22,3 +22,22 @@ export declare const ListSpacesOutputSchema: z.ZodObject<{
22
22
  has_more: z.ZodBoolean;
23
23
  }, z.core.$strip>;
24
24
  export type ListSpacesOutput = z.infer<typeof ListSpacesOutputSchema>;
25
+ export declare const SearchResultBlockItemSchema: z.ZodObject<{
26
+ block_id: z.ZodString;
27
+ title: z.ZodString;
28
+ type: z.ZodString;
29
+ props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
30
+ distance: z.ZodNullable<z.ZodNumber>;
31
+ }, z.core.$strip>;
32
+ export type SearchResultBlockItem = z.infer<typeof SearchResultBlockItemSchema>;
33
+ export declare const SpaceSearchResultSchema: z.ZodObject<{
34
+ cited_blocks: z.ZodArray<z.ZodObject<{
35
+ block_id: z.ZodString;
36
+ title: z.ZodString;
37
+ type: z.ZodString;
38
+ props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
39
+ distance: z.ZodNullable<z.ZodNumber>;
40
+ }, z.core.$strip>>;
41
+ final_answer: z.ZodNullable<z.ZodString>;
42
+ }, z.core.$strip>;
43
+ export type SpaceSearchResult = z.infer<typeof SpaceSearchResultSchema>;
@@ -3,12 +3,12 @@
3
3
  * Type definitions for space resources.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ListSpacesOutputSchema = exports.SpaceSchema = void 0;
6
+ exports.SpaceSearchResultSchema = exports.SearchResultBlockItemSchema = exports.ListSpacesOutputSchema = exports.SpaceSchema = void 0;
7
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
- configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
11
+ configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable(),
12
12
  created_at: zod_1.z.string(),
13
13
  updated_at: zod_1.z.string(),
14
14
  });
@@ -17,3 +17,14 @@ exports.ListSpacesOutputSchema = zod_1.z.object({
17
17
  next_cursor: zod_1.z.string().nullable().optional(),
18
18
  has_more: zod_1.z.boolean(),
19
19
  });
20
+ exports.SearchResultBlockItemSchema = zod_1.z.object({
21
+ block_id: zod_1.z.string(),
22
+ title: zod_1.z.string(),
23
+ type: zod_1.z.string(),
24
+ props: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
25
+ distance: zod_1.z.number().nullable(),
26
+ });
27
+ exports.SpaceSearchResultSchema = zod_1.z.object({
28
+ cited_blocks: zod_1.z.array(exports.SearchResultBlockItemSchema),
29
+ final_answer: zod_1.z.string().nullable(),
30
+ });
@@ -0,0 +1,23 @@
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>;
20
+ export declare const InsertBlockResponseSchema: z.ZodObject<{
21
+ id: z.ZodString;
22
+ }, z.core.$strip>;
23
+ export type InsertBlockResponse = z.infer<typeof InsertBlockResponseSchema>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * Type definitions for tool resources.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.InsertBlockResponseSchema = 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
+ });
20
+ exports.InsertBlockResponseSchema = zod_1.z.object({
21
+ id: zod_1.z.string(),
22
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acontext/acontext",
3
- "version": "0.0.1",
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",