@acontext/acontext 0.0.13 → 0.0.15

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.
@@ -6,6 +6,7 @@ export interface BaseContext {
6
6
  export interface BaseConverter {
7
7
  toOpenAIToolSchema(): Record<string, unknown>;
8
8
  toAnthropicToolSchema(): Record<string, unknown>;
9
+ toGeminiToolSchema(): Record<string, unknown>;
9
10
  }
10
11
  export interface BaseTool extends BaseConverter {
11
12
  readonly name: string;
@@ -22,6 +23,7 @@ export declare abstract class AbstractBaseTool implements BaseTool {
22
23
  abstract execute(ctx: BaseContext, llmArguments: Record<string, unknown>): Promise<string>;
23
24
  toOpenAIToolSchema(): Record<string, unknown>;
24
25
  toAnthropicToolSchema(): Record<string, unknown>;
26
+ toGeminiToolSchema(): Record<string, unknown>;
25
27
  }
26
28
  export declare abstract class BaseToolPool {
27
29
  protected tools: Map<string, BaseTool>;
@@ -32,5 +34,6 @@ export declare abstract class BaseToolPool {
32
34
  toolExists(toolName: string): boolean;
33
35
  toOpenAIToolSchema(): Record<string, unknown>[];
34
36
  toAnthropicToolSchema(): Record<string, unknown>[];
37
+ toGeminiToolSchema(): Record<string, unknown>[];
35
38
  abstract formatContext(...args: unknown[]): BaseContext;
36
39
  }
@@ -30,6 +30,17 @@ class AbstractBaseTool {
30
30
  },
31
31
  };
32
32
  }
33
+ toGeminiToolSchema() {
34
+ return {
35
+ name: this.name,
36
+ description: this.description,
37
+ parameters: {
38
+ type: 'object',
39
+ properties: this.arguments,
40
+ required: this.requiredArguments,
41
+ },
42
+ };
43
+ }
33
44
  }
34
45
  exports.AbstractBaseTool = AbstractBaseTool;
35
46
  class BaseToolPool {
@@ -64,5 +75,8 @@ class BaseToolPool {
64
75
  toAnthropicToolSchema() {
65
76
  return Array.from(this.tools.values()).map((tool) => tool.toAnthropicToolSchema());
66
77
  }
78
+ toGeminiToolSchema() {
79
+ return Array.from(this.tools.values()).map((tool) => tool.toGeminiToolSchema());
80
+ }
67
81
  }
68
82
  exports.BaseToolPool = BaseToolPool;
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Internal constants shared across the TypeScript SDK.
3
3
  */
4
- export declare const DEFAULT_BASE_URL = "https://api.acontext.io/api/v1";
4
+ export declare const DEFAULT_BASE_URL = "https://api.acontext.app/api/v1";
5
5
  export declare const DEFAULT_USER_AGENT = "acontext-ts/0.0.1";
package/dist/constants.js CHANGED
@@ -4,5 +4,5 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.DEFAULT_USER_AGENT = exports.DEFAULT_BASE_URL = void 0;
7
- exports.DEFAULT_BASE_URL = 'https://api.acontext.io/api/v1';
7
+ exports.DEFAULT_BASE_URL = 'https://api.acontext.app/api/v1';
8
8
  exports.DEFAULT_USER_AGENT = 'acontext-ts/0.0.1';
@@ -35,7 +35,7 @@ export declare class SessionsAPI {
35
35
  timeDesc?: boolean | null;
36
36
  }): Promise<GetTasksOutput>;
37
37
  storeMessage(sessionId: string, blob: MessageBlob, options?: {
38
- format?: 'acontext' | 'openai' | 'anthropic';
38
+ format?: 'acontext' | 'openai' | 'anthropic' | 'gemini';
39
39
  fileField?: string | null;
40
40
  file?: FileUpload | null;
41
41
  }): Promise<Message>;
@@ -47,7 +47,7 @@ export declare class SessionsAPI {
47
47
  * @param options.limit - Maximum number of messages to return.
48
48
  * @param options.cursor - Cursor for pagination.
49
49
  * @param options.withAssetPublicUrl - Whether to include presigned URLs for assets.
50
- * @param options.format - The format of the messages ('acontext', 'openai', or 'anthropic').
50
+ * @param options.format - The format of the messages ('acontext', 'openai', 'anthropic', or 'gemini').
51
51
  * @param options.timeDesc - Order by created_at descending if true, ascending if false.
52
52
  * @param options.editStrategies - Optional list of edit strategies to apply before format conversion.
53
53
  * Examples:
@@ -59,7 +59,7 @@ export declare class SessionsAPI {
59
59
  limit?: number | null;
60
60
  cursor?: string | null;
61
61
  withAssetPublicUrl?: boolean | null;
62
- format?: 'acontext' | 'openai' | 'anthropic';
62
+ format?: 'acontext' | 'openai' | 'anthropic' | 'gemini';
63
63
  timeDesc?: boolean | null;
64
64
  editStrategies?: Array<EditStrategy> | null;
65
65
  }): Promise<GetMessagesOutput>;
@@ -75,8 +75,8 @@ class SessionsAPI {
75
75
  }
76
76
  async storeMessage(sessionId, blob, options) {
77
77
  const format = options?.format ?? 'openai';
78
- if (!['acontext', 'openai', 'anthropic'].includes(format)) {
79
- throw new Error("format must be one of {'acontext', 'openai', 'anthropic'}");
78
+ if (!['acontext', 'openai', 'anthropic', 'gemini'].includes(format)) {
79
+ throw new Error("format must be one of {'acontext', 'openai', 'anthropic', 'gemini'}");
80
80
  }
81
81
  if (options?.file && !options?.fileField) {
82
82
  throw new Error('fileField is required when file is provided');
@@ -126,7 +126,7 @@ class SessionsAPI {
126
126
  * @param options.limit - Maximum number of messages to return.
127
127
  * @param options.cursor - Cursor for pagination.
128
128
  * @param options.withAssetPublicUrl - Whether to include presigned URLs for assets.
129
- * @param options.format - The format of the messages ('acontext', 'openai', or 'anthropic').
129
+ * @param options.format - The format of the messages ('acontext', 'openai', 'anthropic', or 'gemini').
130
130
  * @param options.timeDesc - Order by created_at descending if true, ascending if false.
131
131
  * @param options.editStrategies - Optional list of edit strategies to apply before format conversion.
132
132
  * Examples:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acontext/acontext",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "TypeScript SDK for the Acontext API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",