@acontext/acontext 0.0.6 → 0.0.7

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, LearningStatus, ListSessionsOutput, Message, Session } from '../types';
7
+ import { GetMessagesOutput, GetTasksOutput, LearningStatus, ListSessionsOutput, Message, Session, TokenCounts } from '../types';
8
8
  export type MessageBlob = AcontextMessage | Record<string, unknown>;
9
9
  export declare class SessionsAPI {
10
10
  private requester;
@@ -59,4 +59,11 @@ export declare class SessionsAPI {
59
59
  * @returns LearningStatus object containing space_digested_count and not_space_digested_count.
60
60
  */
61
61
  getLearningStatus(sessionId: string): Promise<LearningStatus>;
62
+ /**
63
+ * Get total token counts for all text and tool-call parts in a session.
64
+ *
65
+ * @param sessionId - The UUID of the session.
66
+ * @returns TokenCounts object containing total_tokens.
67
+ */
68
+ getTokenCounts(sessionId: string): Promise<TokenCounts>;
62
69
  }
@@ -148,5 +148,15 @@ class SessionsAPI {
148
148
  const data = await this.requester.request('GET', `/session/${sessionId}/get_learning_status`);
149
149
  return types_1.LearningStatusSchema.parse(data);
150
150
  }
151
+ /**
152
+ * Get total token counts for all text and tool-call parts in a session.
153
+ *
154
+ * @param sessionId - The UUID of the session.
155
+ * @returns TokenCounts object containing total_tokens.
156
+ */
157
+ async getTokenCounts(sessionId) {
158
+ const data = await this.requester.request('GET', `/session/${sessionId}/token_counts`);
159
+ return types_1.TokenCountsSchema.parse(data);
160
+ }
151
161
  }
152
162
  exports.SessionsAPI = SessionsAPI;
@@ -124,3 +124,7 @@ export declare const LearningStatusSchema: z.ZodObject<{
124
124
  not_space_digested_count: z.ZodNumber;
125
125
  }, z.core.$strip>;
126
126
  export type LearningStatus = z.infer<typeof LearningStatusSchema>;
127
+ export declare const TokenCountsSchema: z.ZodObject<{
128
+ total_tokens: z.ZodNumber;
129
+ }, z.core.$strip>;
130
+ export type TokenCounts = z.infer<typeof TokenCountsSchema>;
@@ -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.LearningStatusSchema = exports.GetTasksOutputSchema = exports.GetMessagesOutputSchema = exports.PublicURLSchema = exports.ListSessionsOutputSchema = exports.TaskSchema = exports.SessionSchema = exports.MessageSchema = exports.PartSchema = exports.AssetSchema = void 0;
6
+ exports.TokenCountsSchema = 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(),
@@ -76,3 +76,6 @@ exports.LearningStatusSchema = zod_1.z.object({
76
76
  space_digested_count: zod_1.z.number(),
77
77
  not_space_digested_count: zod_1.z.number(),
78
78
  });
79
+ exports.TokenCountsSchema = zod_1.z.object({
80
+ total_tokens: zod_1.z.number(),
81
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acontext/acontext",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "TypeScript SDK for the Acontext API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",