@acontext/acontext 0.0.4 → 0.0.6
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.
|
@@ -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 { GetMessagesOutput, GetTasksOutput, ListSessionsOutput, Message, Session } from '../types';
|
|
7
|
+
import { GetMessagesOutput, GetTasksOutput, LearningStatus, ListSessionsOutput, Message, Session } from '../types';
|
|
8
8
|
export type MessageBlob = AcontextMessage | Record<string, unknown>;
|
|
9
9
|
export declare class SessionsAPI {
|
|
10
10
|
private requester;
|
|
@@ -49,4 +49,14 @@ export declare class SessionsAPI {
|
|
|
49
49
|
status: number;
|
|
50
50
|
errmsg: string;
|
|
51
51
|
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Get learning status for a session.
|
|
54
|
+
*
|
|
55
|
+
* Returns the count of space digested tasks and not space digested tasks.
|
|
56
|
+
* If the session is not connected to a space, returns 0 and 0.
|
|
57
|
+
*
|
|
58
|
+
* @param sessionId - The UUID of the session.
|
|
59
|
+
* @returns LearningStatus object containing space_digested_count and not_space_digested_count.
|
|
60
|
+
*/
|
|
61
|
+
getLearningStatus(sessionId: string): Promise<LearningStatus>;
|
|
52
62
|
}
|
|
@@ -135,5 +135,18 @@ class SessionsAPI {
|
|
|
135
135
|
const data = await this.requester.request('POST', `/session/${sessionId}/flush`);
|
|
136
136
|
return data;
|
|
137
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Get learning status for a session.
|
|
140
|
+
*
|
|
141
|
+
* Returns the count of space digested tasks and not space digested tasks.
|
|
142
|
+
* If the session is not connected to a space, returns 0 and 0.
|
|
143
|
+
*
|
|
144
|
+
* @param sessionId - The UUID of the session.
|
|
145
|
+
* @returns LearningStatus object containing space_digested_count and not_space_digested_count.
|
|
146
|
+
*/
|
|
147
|
+
async getLearningStatus(sessionId) {
|
|
148
|
+
const data = await this.requester.request('GET', `/session/${sessionId}/get_learning_status`);
|
|
149
|
+
return types_1.LearningStatusSchema.parse(data);
|
|
150
|
+
}
|
|
138
151
|
}
|
|
139
152
|
exports.SessionsAPI = SessionsAPI;
|
package/dist/types/session.d.ts
CHANGED
|
@@ -119,3 +119,8 @@ export declare const GetTasksOutputSchema: z.ZodObject<{
|
|
|
119
119
|
has_more: z.ZodBoolean;
|
|
120
120
|
}, z.core.$strip>;
|
|
121
121
|
export type GetTasksOutput = z.infer<typeof GetTasksOutputSchema>;
|
|
122
|
+
export declare const LearningStatusSchema: z.ZodObject<{
|
|
123
|
+
space_digested_count: z.ZodNumber;
|
|
124
|
+
not_space_digested_count: z.ZodNumber;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
export type LearningStatus = z.infer<typeof LearningStatusSchema>;
|
package/dist/types/session.js
CHANGED
|
@@ -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.GetTasksOutputSchema = exports.GetMessagesOutputSchema = exports.PublicURLSchema = exports.ListSessionsOutputSchema = exports.TaskSchema = exports.SessionSchema = exports.MessageSchema = exports.PartSchema = exports.AssetSchema = void 0;
|
|
6
|
+
exports.LearningStatusSchema = exports.GetTasksOutputSchema = exports.GetMessagesOutputSchema = exports.PublicURLSchema = exports.ListSessionsOutputSchema = exports.TaskSchema = 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(),
|
|
@@ -72,3 +72,7 @@ exports.GetTasksOutputSchema = zod_1.z.object({
|
|
|
72
72
|
next_cursor: zod_1.z.string().nullable().optional(),
|
|
73
73
|
has_more: zod_1.z.boolean(),
|
|
74
74
|
});
|
|
75
|
+
exports.LearningStatusSchema = zod_1.z.object({
|
|
76
|
+
space_digested_count: zod_1.z.number(),
|
|
77
|
+
not_space_digested_count: zod_1.z.number(),
|
|
78
|
+
});
|
package/dist/types/space.d.ts
CHANGED
|
@@ -38,6 +38,6 @@ export declare const SpaceSearchResultSchema: z.ZodObject<{
|
|
|
38
38
|
props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
39
39
|
distance: z.ZodNullable<z.ZodNumber>;
|
|
40
40
|
}, z.core.$strip>>;
|
|
41
|
-
final_answer: z.ZodNullable<z.ZodString
|
|
41
|
+
final_answer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
42
42
|
}, z.core.$strip>;
|
|
43
43
|
export type SpaceSearchResult = z.infer<typeof SpaceSearchResultSchema>;
|
package/dist/types/space.js
CHANGED
|
@@ -26,5 +26,5 @@ exports.SearchResultBlockItemSchema = zod_1.z.object({
|
|
|
26
26
|
});
|
|
27
27
|
exports.SpaceSearchResultSchema = zod_1.z.object({
|
|
28
28
|
cited_blocks: zod_1.z.array(exports.SearchResultBlockItemSchema),
|
|
29
|
-
final_answer: zod_1.z.string().nullable(),
|
|
29
|
+
final_answer: zod_1.z.string().nullable().optional(),
|
|
30
30
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acontext/acontext",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "TypeScript SDK for the Acontext API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
],
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/memodb-io/Acontext"
|
|
26
|
+
},
|
|
23
27
|
"dependencies": {
|
|
24
28
|
"zod": "^4.1.12"
|
|
25
29
|
},
|
|
@@ -49,5 +53,4 @@
|
|
|
49
53
|
"dist",
|
|
50
54
|
"README.md"
|
|
51
55
|
]
|
|
52
|
-
}
|
|
53
|
-
|
|
56
|
+
}
|