tekimax-ts 0.2.1 → 0.2.4

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,28 +1,51 @@
1
1
  <div align="center">
2
- <img src="https://raw.githubusercontent.com/TEKIMAX/tekimax-ts/main/apps/docs/public/tekimax-logo.png" alt="Tekimax SDK Logo" width="200" />
3
- <h1>Tekimax TS</h1>
4
- <p><strong>The Universal Standard.</strong></p>
5
- <p>A type-safe, framework-agnostic AI SDK for building AI-powered apps.</p>
6
-
7
- [![npm version](https://img.shields.io/npm/v/tekimax-ts.svg)](https://www.npmjs.com/package/tekimax-ts)
8
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2
+ <img src="https://raw.githubusercontent.com/TEKIMAX/tekimax-ts/main/apps/docs/public/tekimax-logo.png" alt="Tekimax SDK Logo" width="120" />
3
+ <h1>Tekimax SDK</h1>
4
+ <p><strong>The Universal Standard</strong></p>
5
+
6
+ <p>
7
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a>
8
+ <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.0-3178C6.svg" alt="TypeScript"></a>
9
+ <a href="https://tekimax.com"><img src="https://img.shields.io/badge/Standard-Tekimax-000000.svg" alt="Standard"></a>
10
+ <a href="https://www.npmjs.com/package/tekimax-ts"><img src="https://img.shields.io/npm/v/tekimax-ts.svg" alt="NPM Version"></a>
11
+ <a href="https://packagephobia.com/result?p=tekimax-ts"><img src="https://packagephobia.com/badge?p=tekimax-ts" alt="Bundle Size"></a>
12
+ </p>
13
+
14
+ <p>
15
+ Integrate <strong>OpenAI</strong>, <strong>Anthropic</strong>, <strong>Gemini</strong>, <strong>Ollama</strong>, <strong>Grok</strong>, and <strong>OpenRouter</strong> with a single, type-safe API.
16
+ </p>
9
17
 
18
+ <div>
19
+ <img src="https://img.shields.io/badge/OpenAI-412991?style=for-the-badge&logo=openai&logoColor=white" alt="OpenAI" />
20
+ <img src="https://img.shields.io/badge/Anthropic-D06940?style=for-the-badge&logo=anthropic&logoColor=white" alt="Anthropic" />
21
+ <img src="https://img.shields.io/badge/Gemini-8E75B2?style=for-the-badge&logo=google%20gemini&logoColor=white" alt="Gemini" />
22
+ <img src="https://img.shields.io/badge/Ollama-000000?style=for-the-badge&logo=ollama&logoColor=white" alt="Ollama" />
23
+ <img src="https://img.shields.io/badge/Grok-000000?style=for-the-badge&logo=x&logoColor=white" alt="Grok" />
24
+ <img src="https://img.shields.io/badge/OpenRouter-6366F1?style=for-the-badge&logo=openai&logoColor=white" alt="OpenRouter" />
25
+ </div>
10
26
  </div>
11
27
 
12
- ## 📦 Installation
28
+ ---
13
29
 
14
- ```bash
15
- npm install tekimax-ts
16
- ```
30
+ ## 🚀 The Universal Standard
17
31
 
18
- ## 🌟 Features
32
+ The **Tekimax SDK** solves the fragmentation of AI APIs. Instead of rewriting your integration code for every provider (handling different request formats, streaming implementations, and error types), you use **one standard interface**.
19
33
 
20
- - **Universal API**: One interface for all providers. Switch from OpenAI to Ollama with a single config change.
21
- - **Strict Modality Type Safety**: End-to-end TypeScript support. Strong capability interfaces ensure compile-time safety (e.g., your code won't compile if you call `.images.generate()` on a provider missing the `ImageGenerationCapability`). Zod schemas for runtime validation.
22
- - **Zero Latency**: Lightweight adapter pattern with zero runtime overhead.
23
- - **Zero CVEs**: Hardened supply chain using Chainguard images.
34
+ - **Write Once, Run Anywhere**: Switch between OpenAI (Cloud) and Ollama (Local) with a single line of config.
35
+ - **Type-Safe**: Full TypeScript support with Zod validation for inputs and outputs.
36
+ - **Multi-Modal**: Text, images, audio, video, and **embeddings** through a unified namespace API.
37
+ - **OpenResponses Catalog**: Fuses `models.dev` metadata into standard `ModelDefinition` objects for reasoning, modalities, and token limits.
38
+ - **Middleware Plugins**: Built-in architecture for Security (`PIIFilterPlugin`), Scalability (`MaxContextOverflowPlugin`), and Telemetry (`LoggerPlugin`).
39
+ - **React Ready**: Includes a `useChat` hook for instant UI integration, complete with SSE streaming.
24
40
  - **Redis Adapter** _(optional)_: Response caching, rate limiting, token budgets, and session storage with any Redis client.
25
- - **Convex Integration**: Provision and manage [Convex](https://convex.dev) projects, push schemas, set env vars, and deploy — all from code.
41
+
42
+
43
+ ## 💻 Installation
44
+
45
+ ```bash
46
+ # Install core and your desired adapters
47
+ npm install tekimax-ts
48
+ ```
26
49
 
27
50
  ## 💻 Usage
28
51
 
@@ -53,60 +76,6 @@ const claude = new Tekimax({
53
76
  const local = new Tekimax({
54
77
  provider: new OllamaProvider({ baseUrl: 'http://localhost:11434' })
55
78
  })
56
-
57
- // Custom Model Proxies (e.g. Internal API gateways)
58
- const proxyClient = new Tekimax({
59
- provider: new OpenAIProvider({
60
- apiKey: process.env.CUSTOM_PROXY_KEY,
61
- baseURL: 'https://api.my-custom-proxy.internal/v1'
62
- })
63
- })
64
-
65
- ### Streaming
66
-
67
- Tekimax-TS uses standard Javascript Async Iterables for real-time streaming:
68
-
69
- ```typescript
70
- const stream = await client.text.generateStream({
71
- model: "gpt-4o",
72
- messages: [{ role: "user", content: "Tell me a story" }]
73
- })
74
-
75
- for await (const chunk of stream) {
76
- process.stdout.write(chunk.delta)
77
- }
78
- ```
79
-
80
- ## 🔌 Plugin Architecture (Lifecycle Hooks)
81
-
82
- The SDK provides a robust middleware architecture via `plugins`. You can snap in pre-built plugins for Security, Scalability, and Telemetry, or build your own.
83
-
84
- ```typescript
85
- import { Tekimax, OpenAIProvider, PIIFilterPlugin, LoggerPlugin, MaxContextOverflowPlugin } from 'tekimax-ts'
86
-
87
- const client = new Tekimax({
88
- provider: new OpenAIProvider({ apiKey: 'sk-...' }),
89
- plugins: [
90
- new LoggerPlugin(), // Telemetry
91
- new PIIFilterPlugin(), // Security: Redacts emails and SSNs
92
- new MaxContextOverflowPlugin(15) // Scalability: Prevents context bloat in long loops
93
- ]
94
- })
95
- ```
96
-
97
- ### Building Custom Plugins
98
- Implement the `TekimaxPlugin` interface to hook into the request/response lifecycle:
99
-
100
- ```typescript
101
- export interface TekimaxPlugin {
102
- name: string
103
- onInit?: (client: Tekimax) => void
104
- beforeRequest?: (context: PluginContext) => Promise<void | PluginContext>
105
- afterResponse?: (context: PluginContext, result: ChatResult) => Promise<void>
106
- onStreamChunk?: (context: PluginContext, chunk: StreamChunk) => void
107
- beforeToolExecute?: (toolName: string, args: unknown) => Promise<void>
108
- afterToolExecute?: (toolName: string, result: unknown) => Promise<void>
109
- }
110
79
  ```
111
80
 
112
81
  ### 2. Multi-Modal Interfaces
@@ -161,110 +130,95 @@ const analysis = await client.videos.analyze({
161
130
  })
162
131
  ```
163
132
 
164
- ## 📚 Documentation
165
-
166
- For full documentation, guides, and API references, visit **[docs.tekimax.com](https://docs.tekimax.com)**.
167
-
168
- ## 🧠 Motivation
169
-
170
-
171
- Modern LLM systems have converged on similar primitives: messages, function calls, tool usage, and multimodal inputs but each provider encodes them differently. **Tekimax** standardizes these concepts, enabling:
172
-
173
- - **One spec, many providers**: Describe inputs/outputs once; run on OpenAI, Anthropic, Gemini, or local models.
174
- - **Composable agentic loops**: Unified streaming, tool invocation, and message orchestration.
175
- - **Easier evaluation and routing**: Compare providers, route requests, and log results through a shared schema.
176
- - **Blueprints for provider APIs**: Labs and model providers wanting to expose their APIs in a common format can easily do so.
177
-
178
- ## 🔑 Key Principles
179
-
180
- ### Agentic Loop
181
-
182
- All models, to some extent, exhibit agency: the ability to perceive input, reason, act through tools, and reflect on outcomes.
133
+ #### Embeddings
183
134
 
184
- The **Tekimax Standard** at its core is designed to expose the power of this agentic loop to developers, making requests that allow the model to do multiple things and yield back a result, whether this is developer-hosted tool calls where control is yielded back to the user, or provider-hosted tools where control is held by the model provider until the model signals an exit criteria.
185
-
186
- Tekimax defines a common pattern for defining control flow in the agent loop, a set of item definitions for developer-controlled tools, and pattern for defining provider and router-hosted tools.
187
-
188
- ### Items → Items
189
-
190
- Items are the fundamental unit of context in Tekimax: they represent an atomic unit of model output, tool invocation, or reasoning state. Items are bidirectional, they can be provided as inputs to the model, or as outputs from the model.
191
-
192
- Each item type has a defined schema that binds it and contains properties specific to its unique purpose.
135
+ ```typescript
136
+ const vectors = await client.text.embed({
137
+ model: 'text-embedding-3-small',
138
+ input: ['Hello world', 'Tekimax SDK is awesome']
139
+ })
140
+ console.log(vectors.embeddings)
141
+ ```
193
142
 
194
- Tekimax defines a common set of items supported by a quorum of model providers, and defines how provider-specific item types can be defined.
143
+ ### 3. Cross-Provider Model Catalog
195
144
 
196
- ### Semantic Events
145
+ The SDK strictly implements the **OpenResponses** schema, optionally fusing metadata from `models.dev` so your application always knows what capabilities the active provider supports.
197
146
 
198
- Streaming is modeled as a series of semantic events, not raw text or object deltas.
147
+ ```typescript
148
+ // Returns standard ModelDefinition[] populated with reasoning levels, modal limits, and costs
149
+ const models = await client.provider.getModels?.()
199
150
 
200
- Events describe meaningful transitions. They are either state transitions (e.g., `response.in_progress`, `response.completed`) or they can represent a delta from a previous state (e.g., `response.output_item.added`, `response.output_text.delta`).
151
+ if (models) {
152
+ console.log(models.find(m => m.id === 'gpt-4o')?.modalities.input) // ['text', 'image', 'audio', 'video']
153
+ }
154
+ ```
201
155
 
202
- Tekimax defines a common set of streaming events supported by a quorum of model providers, and defines how provider-specific streaming events can be defined.
156
+ ## 🏗️ Monorepo Structure
203
157
 
204
- ### State Machines
158
+ This repository is managed as a **Turborepo** monorepo.
205
159
 
206
- Objects in Tekimax are state machines, that is, they can live in one of a finite number of states, such as `in_progress`, `completed`, or `failed`. The spec defines the set of valid states for each state machine in the API.
160
+ - **`apps/docs`**: Documentation site (Next.js + Fumadocs).
161
+ - **`packages/*`**: Core SDK and Provider Adapters.
162
+ - **`tekimax-cli`**: Developer tools for Tekimax.
207
163
 
208
- ## 🛡️ Security & Trust
164
+ ### Commands
209
165
 
210
- At **Tekimax**, we believe security is a feature, not an afterthought.
166
+ ```bash
167
+ # Build all packages
168
+ npx turbo build
211
169
 
212
- - **Zero Vulnerabilities**: We enforce a strict **Zero CVE** policy. Our SDK is audited daily.
213
- - **Minimal Surface Area**: By optimizing our dependency tree, we identified and **removed 159 unnecessary packages**, drastically reducing the attack surface.
214
- - **Secured by Chainguard**: Our build pipeline and artifacts rely on [Chainguard Images](https://www.chainguard.dev/chainguard-images)—hardened, minimal container images designed to secure the software supply chain. Chainguard images are stripped of shells, package managers, and other unnecessary tools that attackers often exploit.
170
+ # Run tests
171
+ npx turbo test
215
172
 
216
- Supply chain attacks on the Node.js/npm ecosystem are increasingly common. By building on Chainguard, we ensure that the Tekimax SDK meets the highest standards of integrity and safety for enterprise and production use.
173
+ # Start Docs Site
174
+ npx turbo dev --filter=docs
175
+ ```
217
176
 
218
177
  ## ⚡ Optional Redis Adapter
219
178
 
179
+ No extra dependency — bring your own `ioredis`, `@upstash/redis`, or `node-redis`:
180
+
220
181
  ```typescript
221
182
  import { ResponseCache, RateLimiter, TokenBudget, SessionStore } from 'tekimax-ts'
222
183
  import Redis from 'ioredis'
223
184
 
224
185
  const redis = new Redis(process.env.REDIS_URL)
225
- const cache = new ResponseCache(redis, { ttl: 3600 }) // Cache responses
226
- const limiter = new RateLimiter(redis, { maxRequests: 60 }) // Rate limit
227
- const budget = new TokenBudget(redis, { maxTokens: 100_000 }) // Token budget
228
- const sessions = new SessionStore(redis, { ttl: 1800 }) // Sessions
186
+
187
+ // Cache AI responses (avoid repeat API costs)
188
+ const cache = new ResponseCache(redis, { ttl: 3600 })
189
+
190
+ // Enforce rate limits per provider
191
+ const limiter = new RateLimiter(redis, { maxRequests: 60, windowSeconds: 60 })
192
+
193
+ // Track daily token spend
194
+ const budget = new TokenBudget(redis, { maxTokens: 100_000, periodSeconds: 86400 })
195
+
196
+ // Conversation state for serverless
197
+ const sessions = new SessionStore(redis, { ttl: 1800 })
229
198
  ```
230
199
 
231
200
  ## 🗺️ Roadmap
232
201
 
233
202
  | Feature | Description | Status |
234
203
  |---------|-------------|--------|
235
- | **Batch API** | OpenAI's Batch API for 50% cost reduction on large jobs. Queue thousands of requests and retrieve results asynchronously. | 🔜 Planned |
236
- | **Edge Runtime** | Cloudflare Workers / Deno support. Current `Buffer` usage blocks edge compatibility will be replaced with `Uint8Array` and Web Streams. | 🔜 Planned |
237
- | **Assistants / Threads** | Stateful conversation management with persistence. Create threads, append messages, and resume conversations across sessions. | 🔜 Planned |
238
- | **Fine-tuning API** | Programmatic fine-tuning via OpenAI and Gemini APIs. Upload training data, launch jobs, and deploy custom models through a unified interface. | 🔜 Planned |
239
- | **Observability** | OpenTelemetry spans for every provider call — latency, tokens, cost, and error rate. | 🔜 Planned |
240
- | **Convex Integration** | Provision and manage [Convex](https://convex.dev) projects directly via the SDK. Create projects, push schemas, set env vars, and deploy. | Shipped |
241
- | **Redis Adapter** | Optional response caching, rate limiting, token budget tracking, and session storage with any Redis-compatible client. | Shipped |
204
+ | **Middleware Plugins** | Pre-built and custom lifecycle hooks for Security, Telemetry, and Scalability. | Shipped |
205
+ | **OpenResponses Catalog** | Provider abstraction parsing `models.dev` metadata for token limits, reasoning capabilities, and allowed modalities. | Shipped |
206
+ | **Real-time SSE Streaming** | Native SDK token streaming, `StreamChunk` event typing, and full React hooks support (`useChat`). | Shipped |
207
+ | **Redis Adapter** | Optional response caching, rate limiting, token budget tracking, and session storage with any Redis client. | Shipped |
208
+ | **Observability** | Telemetry and tracing via `plugins` architecture. | Shipped |
209
+ | **Batch API** | Queue thousands of requests and retrieve results asynchronously. | 🔜 Planned |
210
+ | **Edge Runtime** | Cloudflare Workers / Deno support. | 🔜 Planned |
211
+ | **Assistants / Threads** | Stateful conversation management with persistence. | 🔜 Planned |
212
+ | **Fine-tuning API** | Programmatic fine-tuning via internal and integrated APIs. | 🔜 Planned |
242
213
 
243
214
  > **Want to help?** Pick a feature and open a PR, or join the discussion in [GitHub Issues](https://github.com/TEKIMAX/tekimax-ts/issues).
244
215
 
245
- ## Get Involved
216
+ ## 💖 Support
246
217
 
247
- - We welcome issues and pull requests!
248
- - Participate in **GitHub Discussions**.
249
- - See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup instructions.
218
+ Tekimax is open source. If you find it valuable, please consider [becoming a sponsor](https://github.com/sponsors/TEKIMAX) to support long-term maintenance.
250
219
 
251
- ## Partners
252
-
253
- We're looking for Tekimax Partners to join our mission! Partner with us to push the boundaries of Tekimax and build amazing things together.
254
-
255
- [LET'S CHAT](mailto:info@tekimax.com?subject=Tekimax%20Partnership)
256
-
257
- ## Code of Conduct
258
-
259
- ## Please note that this project is released with a [Contributor Code of Conduct](./CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
220
+ ---
260
221
 
261
222
  <div align="center">
262
- <p>
263
- <strong>Secured by <a href="https://www.chainguard.dev">Chainguard</a></strong><br>
264
- Zero-CVE Images for a Safe Supply Chain
265
- </p>
266
- <p>
267
- Built on the <a href="https://openresponses.org">OpenResponses Standard</a> • Generated with <a href="https://kubb.dev">Kubb</a>
268
- </p>
269
- <sub>Built with ❤️ by the Tekimax Team</sub>
223
+ <p>Built with ❤️ by the Tekimax Team</p>
270
224
  </div>
package/dist/index.cjs CHANGED
@@ -32,7 +32,6 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  AnthropicProvider: () => AnthropicProvider,
34
34
  ApiTypes: () => types_exports,
35
- ConvexManager: () => ConvexManager,
36
35
  FallbackProvider: () => FallbackProvider,
37
36
  GeminiProvider: () => GeminiProvider,
38
37
  GrokProvider: () => GrokProvider,
@@ -2602,166 +2601,6 @@ var FallbackProvider = class {
2602
2601
  }
2603
2602
  };
2604
2603
 
2605
- // src/core/convex.ts
2606
- var MANAGEMENT_API = "https://api.convex.dev/v1";
2607
- var ConvexManager = class {
2608
- constructor(options = {}) {
2609
- this.accessToken = options.accessToken || process.env.CONVEX_ACCESS_TOKEN || "";
2610
- this.teamId = options.teamId || process.env.CONVEX_TEAM_ID;
2611
- if (!this.accessToken) {
2612
- throw new Error(
2613
- "ConvexManager requires an access token. Pass accessToken in options or set CONVEX_ACCESS_TOKEN env var."
2614
- );
2615
- }
2616
- }
2617
- // ─── Project Lifecycle ──────────────────────────────────────────────
2618
- /**
2619
- * Create a new Convex project (includes an initial deployment).
2620
- */
2621
- async createProject(name, options = {}) {
2622
- const teamId = await this.resolveTeamId();
2623
- const body = {
2624
- projectName: name,
2625
- deploymentType: options.deploymentType || "prod"
2626
- };
2627
- if (options.region) {
2628
- body.deploymentRegion = options.region;
2629
- }
2630
- return this.request(
2631
- `${MANAGEMENT_API}/teams/${teamId}/create_project`,
2632
- { method: "POST", body }
2633
- );
2634
- }
2635
- /**
2636
- * List all projects for the team.
2637
- */
2638
- async listProjects() {
2639
- const teamId = await this.resolveTeamId();
2640
- return this.request(
2641
- `${MANAGEMENT_API}/teams/${teamId}/list_projects`
2642
- );
2643
- }
2644
- /**
2645
- * Delete a project by ID.
2646
- */
2647
- async deleteProject(projectId) {
2648
- await this.request(
2649
- `${MANAGEMENT_API}/projects/${projectId}`,
2650
- { method: "DELETE" }
2651
- );
2652
- }
2653
- // ─── Deployment Management ──────────────────────────────────────────
2654
- /**
2655
- * Generate a deploy key for a deployment (needed for schema push / deploy).
2656
- */
2657
- async createDeployKey(deploymentName) {
2658
- const result = await this.request(
2659
- `${MANAGEMENT_API}/deployments/${deploymentName}/create_deploy_key`,
2660
- { method: "POST", body: { name: "sdk-provisioned" } }
2661
- );
2662
- return result.deployKey;
2663
- }
2664
- /**
2665
- * Set environment variables on a deployment (bulk upsert).
2666
- */
2667
- async setEnvVars(deploymentName, vars) {
2668
- await this.request(
2669
- `https://${deploymentName}.convex.cloud/api/v1/update_environment_variables`,
2670
- {
2671
- method: "POST",
2672
- body: { changes: vars },
2673
- authStyle: "deploy"
2674
- }
2675
- );
2676
- }
2677
- /**
2678
- * List environment variables on a deployment.
2679
- */
2680
- async getEnvVars(deploymentName) {
2681
- return this.request(
2682
- `https://${deploymentName}.convex.cloud/api/v1/list_environment_variables`,
2683
- { authStyle: "deploy" }
2684
- );
2685
- }
2686
- /**
2687
- * Push Convex functions and schema to a deployment.
2688
- * Use the Convex CLI directly to run this command.
2689
- */
2690
- deploy(deployKey, options = {}) {
2691
- const cwd = options.projectDir || process.cwd();
2692
- const flags = options.flags?.join(" ") || "";
2693
- const cmd = `CONVEX_DEPLOY_KEY=${deployKey} npx convex deploy --cmd-url-env-var-name CONVEX_URL ${flags}`.trim();
2694
- throw new Error(
2695
- `Deploys must be executed via the CLI. Run the following command in your terminal from ${cwd}:
2696
-
2697
- ${cmd}`
2698
- );
2699
- }
2700
- // ─── Discovery ──────────────────────────────────────────────────────
2701
- /**
2702
- * Resolve token details (type, teamId, name) from the access token.
2703
- */
2704
- async getTokenDetails() {
2705
- return this.request(
2706
- `${MANAGEMENT_API}/token_details`
2707
- );
2708
- }
2709
- /**
2710
- * List available deployment regions.
2711
- */
2712
- async getRegions() {
2713
- const result = await this.request(
2714
- `${MANAGEMENT_API}/deployment_regions`
2715
- );
2716
- return result.items;
2717
- }
2718
- /**
2719
- * Generate an OpenAPI specification from a Convex deployment.
2720
- * Use the Convex CLI directly to run this command.
2721
- *
2722
- * @see https://docs.convex.dev/client/open-api
2723
- */
2724
- generateOpenAPISpec(options = {}) {
2725
- const cwd = options.projectDir || process.cwd();
2726
- const output = options.output || "convex-spec.yaml";
2727
- const extraFlags = options.flags?.join(" ") || "";
2728
- const cmd = `npx convex-helpers open-api-spec --output ${output} ${extraFlags}`.trim();
2729
- throw new Error(
2730
- `OpenAPI generation must be executed via the CLI. Run the following command in your terminal from ${cwd}:
2731
-
2732
- ${cmd}`
2733
- );
2734
- }
2735
- // ─── Internal Helpers ───────────────────────────────────────────────
2736
- async resolveTeamId() {
2737
- if (this.teamId) return this.teamId;
2738
- const details = await this.getTokenDetails();
2739
- this.teamId = details.teamId;
2740
- return this.teamId;
2741
- }
2742
- async request(url, options = {}) {
2743
- const { method = "GET", body, authStyle = "bearer" } = options;
2744
- const headers = {
2745
- "Content-Type": "application/json",
2746
- Authorization: authStyle === "deploy" ? `Convex ${this.accessToken}` : `Bearer ${this.accessToken}`
2747
- };
2748
- const res = await fetch(url, {
2749
- method,
2750
- headers,
2751
- body: body ? JSON.stringify(body) : void 0
2752
- });
2753
- if (!res.ok) {
2754
- const text2 = await res.text().catch(() => "");
2755
- throw new Error(
2756
- `Convex API error (${res.status} ${res.statusText}): ${text2}`
2757
- );
2758
- }
2759
- const text = await res.text();
2760
- if (!text) return void 0;
2761
- return JSON.parse(text);
2762
- }
2763
- };
2764
-
2765
2604
  // src/core/cache.ts
2766
2605
  var ResponseCache = class {
2767
2606
  constructor(redis, options = {}) {
@@ -3055,7 +2894,34 @@ var Tekimax = class {
3055
2894
  }
3056
2895
  };
3057
2896
 
3058
- // src/plugins/index.ts
2897
+ // src/plugins/logger.ts
2898
+ var LoggerPlugin = class {
2899
+ constructor() {
2900
+ this.name = "LoggerPlugin";
2901
+ }
2902
+ onInit() {
2903
+ console.log("[LoggerPlugin] Tekimax SDK initialized with Logger Plugin active.");
2904
+ }
2905
+ async beforeRequest(context) {
2906
+ console.log(`[LoggerPlugin] Sending request to model: ${context.model} (${context.messages.length} messages)`);
2907
+ }
2908
+ async afterResponse(context, result) {
2909
+ console.log(`[LoggerPlugin] Received completion from ${context.model}. Usage:`, result.usage);
2910
+ }
2911
+ onStreamChunk(context, chunk) {
2912
+ if (chunk.usage) {
2913
+ console.log(`[LoggerPlugin] Stream completed. Final usage:`, chunk.usage);
2914
+ }
2915
+ }
2916
+ async beforeToolExecute(toolName, args) {
2917
+ console.log(`[LoggerPlugin] Executing tool '${toolName}' with args:`, args);
2918
+ }
2919
+ async afterToolExecute(toolName, result) {
2920
+ console.log(`[LoggerPlugin] Tool '${toolName}' returned successfully.`);
2921
+ }
2922
+ };
2923
+
2924
+ // src/plugins/pii.ts
3059
2925
  var PIIFilterPlugin = class {
3060
2926
  constructor() {
3061
2927
  this.name = "PIIFilterPlugin";
@@ -3077,6 +2943,8 @@ var PIIFilterPlugin = class {
3077
2943
  return context;
3078
2944
  }
3079
2945
  };
2946
+
2947
+ // src/plugins/context.ts
3080
2948
  var MaxContextOverflowPlugin = class {
3081
2949
  constructor(maxMessages = 20) {
3082
2950
  this.maxMessages = maxMessages;
@@ -3093,36 +2961,10 @@ var MaxContextOverflowPlugin = class {
3093
2961
  return context;
3094
2962
  }
3095
2963
  };
3096
- var LoggerPlugin = class {
3097
- constructor() {
3098
- this.name = "LoggerPlugin";
3099
- }
3100
- onInit() {
3101
- console.log("[LoggerPlugin] Tekimax SDK initialized with Logger Plugin active.");
3102
- }
3103
- async beforeRequest(context) {
3104
- console.log(`[LoggerPlugin] Sending request to model: ${context.model} (${context.messages.length} messages)`);
3105
- }
3106
- async afterResponse(context, result) {
3107
- console.log(`[LoggerPlugin] Received completion from ${context.model}. Usage:`, result.usage);
3108
- }
3109
- onStreamChunk(context, chunk) {
3110
- if (chunk.usage) {
3111
- console.log(`[LoggerPlugin] Stream completed. Final usage:`, chunk.usage);
3112
- }
3113
- }
3114
- async beforeToolExecute(toolName, args) {
3115
- console.log(`[LoggerPlugin] Executing tool '${toolName}' with args:`, args);
3116
- }
3117
- async afterToolExecute(toolName, result) {
3118
- console.log(`[LoggerPlugin] Tool '${toolName}' returned successfully.`);
3119
- }
3120
- };
3121
2964
  // Annotate the CommonJS export names for ESM import in node:
3122
2965
  0 && (module.exports = {
3123
2966
  AnthropicProvider,
3124
2967
  ApiTypes,
3125
- ConvexManager,
3126
2968
  FallbackProvider,
3127
2969
  GeminiProvider,
3128
2970
  GrokProvider,