@alvin0/ai-agent-sdk-provider-gemini 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 alvin0 (chaulamdinhai) <chaulamdinhai@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @alvin0/ai-agent-sdk-provider-gemini
2
+
3
+ Runtime: **Universal** (Edge/Worker, browser, Deno, Bun, and Node).
4
+
5
+ ```sh
6
+ pnpm add @alvin0/ai-agent-sdk-core @alvin0/ai-agent-sdk-provider-gemini
7
+ ```
8
+
9
+ Universal Gemini provider for ai-agent-sdk. It targets only Google's Gemini
10
+ Interactions endpoint at `/v1beta/interactions` and does not use
11
+ `generateContent` or the OpenAI-compatible Chat Completions endpoint.
12
+
13
+ Credentials are always injected. This package never reads `.env`, environment
14
+ variables, or files; a Node host may opt into `envCredential()` from
15
+ `@alvin0/ai-agent-sdk-auth-node`.
@@ -0,0 +1,50 @@
1
+ import { ComposableModelProviderPlugin, CredentialInput, ModelTarget } from "@alvin0/ai-agent-sdk-core/provider";
2
+ import { CredentialSource, HttpModelAdapter, ProviderCatalogModel, ProviderRequestLogger } from "@alvin0/ai-agent-sdk-provider-http";
3
+ import { GeminiInteractionsDialect, geminiInteractionsProtocol } from "@alvin0/ai-agent-sdk-protocol-gemini-interactions";
4
+ import { ModelProviderPlugin, RetryPolicyConfig } from "@alvin0/ai-agent-sdk-core";
5
+ //#region src/adapter.d.ts
6
+ /** Google Gemini API v1beta base. The protocol appends only `/interactions`. */
7
+ declare const GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
8
+ type GeminiCredential = CredentialSource;
9
+ interface GeminiAdapterOptions {
10
+ /** Injected API key or resolver. Universal packages never read environment variables. */
11
+ apiKey: GeminiCredential;
12
+ /** Endpoint base; defaults to {@link GEMINI_BASE_URL}. */
13
+ baseUrl?: string;
14
+ /** Advisory catalog. No model ids are built in, so the list cannot become stale. */
15
+ models?: readonly ProviderCatalogModel[];
16
+ /** Whether Google may retain interactions. Defaults to false. */
17
+ store?: boolean;
18
+ defaultMaxTokens?: number;
19
+ defaultContextWindow?: number;
20
+ streamIdleTimeoutMs?: number;
21
+ requestTimeoutMs?: number;
22
+ maxRequestBytes?: number;
23
+ maxResponseBytes?: number;
24
+ maxResponseChunks?: number;
25
+ maxSseEvents?: number;
26
+ maxSseEventChars?: number;
27
+ maxErrorBodyBytes?: number;
28
+ requestLoggerTimeoutMs?: number;
29
+ retryPolicy?: RetryPolicyConfig;
30
+ requestLogger?: ProviderRequestLogger;
31
+ fetch?: typeof globalThis.fetch;
32
+ }
33
+ declare function geminiAdapter(options: GeminiAdapterOptions): HttpModelAdapter;
34
+ interface GeminiPluginOptions extends GeminiAdapterOptions {
35
+ /** Registry routes installed by the plugin. Defaults to `['gemini']`. */
36
+ readonly routes?: readonly string[];
37
+ }
38
+ interface GeminiProviderOptions extends Omit<GeminiAdapterOptions, 'apiKey'> {
39
+ readonly defaultModel?: string | ModelTarget;
40
+ readonly apiKey: CredentialInput;
41
+ readonly id?: string;
42
+ readonly routes?: readonly string[];
43
+ }
44
+ declare function geminiPlugin(options: GeminiProviderOptions): ComposableModelProviderPlugin & {
45
+ readonly family: 'gemini';
46
+ };
47
+ declare function geminiPlugin(options: GeminiPluginOptions): ModelProviderPlugin;
48
+ //#endregion
49
+ export { GEMINI_BASE_URL, type GeminiAdapterOptions, type GeminiCredential, type GeminiInteractionsDialect, type GeminiPluginOptions, type GeminiProviderOptions, geminiAdapter, geminiInteractionsProtocol, geminiPlugin };
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/adapter.ts"],"mappings":";;;;;;cAuBa;KAED,mBAAmB;UAEd;;EAEf,QAAQ;;EAER;;EAEA,kBAAkB;;EAElB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd,gBAAgB;EAChB,eAAe,WAAW;;iBAGZ,cAAc,SAAS,uBAAuB;UAoB7C,4BAA4B;;WAElC;;UAGM,8BAA8B,KAAK;WACzC,wBAAwB;WACxB,QAAQ;WACR;WACA;;iBAGK,aACd,SAAS,wBACR;WAA2C;;iBAC9B,aAAa,SAAS,sBAAsB"}
package/dist/index.js ADDED
@@ -0,0 +1,113 @@
1
+ import { defineModelProviderPlugin } from "@alvin0/ai-agent-sdk-core/provider";
2
+ import { createHttpProvider, createRuntimeHttpProvider } from "@alvin0/ai-agent-sdk-provider-http";
3
+ import { geminiInteractionsProtocol, geminiInteractionsProtocol as geminiInteractionsProtocol$1 } from "@alvin0/ai-agent-sdk-protocol-gemini-interactions";
4
+
5
+ //#region src/adapter.ts
6
+ /** Google Gemini API v1beta base. The protocol appends only `/interactions`. */
7
+ const GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
8
+ function geminiAdapter(options) {
9
+ return createHttpProvider({
10
+ displayName: "Gemini",
11
+ protocol: geminiInteractionsProtocol$1,
12
+ baseUrl: options.baseUrl ?? "https://generativelanguage.googleapis.com/v1beta",
13
+ auth: {
14
+ kind: "header",
15
+ name: "x-goog-api-key",
16
+ value: options.apiKey,
17
+ label: "the `apiKey` option"
18
+ },
19
+ dialect: dialectOf(options),
20
+ ...options.models === void 0 ? {} : { models: options.models },
21
+ defaultMaxTokens: options.defaultMaxTokens ?? 8192,
22
+ defaultContextWindow: options.defaultContextWindow ?? 1e6,
23
+ ...options.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: options.streamIdleTimeoutMs },
24
+ ...transportLimits(options),
25
+ ...options.retryPolicy === void 0 ? {} : { retryPolicy: options.retryPolicy },
26
+ ...options.requestLogger === void 0 ? {} : { requestLogger: options.requestLogger }
27
+ });
28
+ }
29
+ function geminiPlugin(options) {
30
+ if (!usesRuntimeComposition(options)) return legacyGeminiPlugin(options);
31
+ const id = options.id ?? "gemini";
32
+ const routes = Object.freeze([...options.routes ?? [id]]);
33
+ return defineModelProviderPlugin({
34
+ id,
35
+ family: "gemini",
36
+ displayName: "Gemini",
37
+ routes,
38
+ ...runtimeDefaultModel(options.defaultModel, routes),
39
+ setup(registrar) {
40
+ const remove = registrar.registerAdapter(createRuntimeGeminiAdapter(options));
41
+ return () => {
42
+ remove();
43
+ };
44
+ }
45
+ });
46
+ }
47
+ function legacyGeminiPlugin(options) {
48
+ const routes = Object.freeze([...options.routes ?? ["gemini"]]);
49
+ const adapter = geminiAdapter(options);
50
+ return Object.freeze({
51
+ id: "gemini",
52
+ displayName: "Gemini",
53
+ setup(registrar) {
54
+ registrar.registerAdapter(routes, adapter);
55
+ }
56
+ });
57
+ }
58
+ function createRuntimeGeminiAdapter(options) {
59
+ return createRuntimeHttpProvider({
60
+ displayName: "Gemini",
61
+ protocol: geminiInteractionsProtocol$1,
62
+ baseUrl: options.baseUrl ?? "https://generativelanguage.googleapis.com/v1beta",
63
+ auth: {
64
+ kind: "header",
65
+ name: "x-goog-api-key",
66
+ value: options.apiKey,
67
+ label: "the `apiKey` option"
68
+ },
69
+ dialect: dialectOf(options),
70
+ ...options.models === void 0 ? {} : { models: options.models },
71
+ defaultMaxTokens: options.defaultMaxTokens ?? 8192,
72
+ defaultContextWindow: options.defaultContextWindow ?? 1e6,
73
+ ...options.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: options.streamIdleTimeoutMs },
74
+ ...transportLimits(options),
75
+ ...options.retryPolicy === void 0 ? {} : { retryPolicy: options.retryPolicy },
76
+ ...options.requestLogger === void 0 ? {} : { requestLogger: options.requestLogger }
77
+ });
78
+ }
79
+ function dialectOf(options) {
80
+ return options.store === void 0 ? {} : { store: options.store };
81
+ }
82
+ function usesRuntimeComposition(options) {
83
+ if ("id" in options || "defaultModel" in options) return true;
84
+ if (typeof options.apiKey === "object" && options.apiKey !== null) return true;
85
+ if (typeof options.apiKey !== "function") return true;
86
+ return "kind" in options.apiKey && options.apiKey.kind === "credential-source";
87
+ }
88
+ function runtimeDefaultModel(value, routes) {
89
+ if (value === void 0) return {};
90
+ if (typeof value !== "string") return { defaultModel: value };
91
+ if (routes.length !== 1) throw new TypeError("A string defaultModel requires exactly one Gemini route");
92
+ return { defaultModel: Object.freeze({
93
+ provider: routes[0],
94
+ id: value
95
+ }) };
96
+ }
97
+ function transportLimits(options) {
98
+ return {
99
+ ...options.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: options.requestTimeoutMs },
100
+ ...options.maxRequestBytes === void 0 ? {} : { maxRequestBytes: options.maxRequestBytes },
101
+ ...options.maxResponseBytes === void 0 ? {} : { maxResponseBytes: options.maxResponseBytes },
102
+ ...options.maxResponseChunks === void 0 ? {} : { maxResponseChunks: options.maxResponseChunks },
103
+ ...options.maxSseEvents === void 0 ? {} : { maxSseEvents: options.maxSseEvents },
104
+ ...options.maxSseEventChars === void 0 ? {} : { maxSseEventChars: options.maxSseEventChars },
105
+ ...options.maxErrorBodyBytes === void 0 ? {} : { maxErrorBodyBytes: options.maxErrorBodyBytes },
106
+ ...options.requestLoggerTimeoutMs === void 0 ? {} : { requestLoggerTimeoutMs: options.requestLoggerTimeoutMs },
107
+ ...options.fetch === void 0 ? {} : { fetch: options.fetch }
108
+ };
109
+ }
110
+
111
+ //#endregion
112
+ export { GEMINI_BASE_URL, geminiAdapter, geminiInteractionsProtocol, geminiPlugin };
113
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["geminiInteractionsProtocol"],"sources":["../src/adapter.ts"],"sourcesContent":["import type { ModelProviderPlugin, ModelProviderRegistrar, RetryPolicyConfig } from '@alvin0/ai-agent-sdk-core'\nimport {\n defineModelProviderPlugin,\n type ComposableModelProviderPlugin,\n type CredentialInput,\n type ModelTarget,\n} from '@alvin0/ai-agent-sdk-core/provider'\nimport type {\n HttpModelAdapter,\n ProviderCatalogModel,\n ProviderRequestLogger,\n} from '@alvin0/ai-agent-sdk-provider-http'\nimport {\n createHttpProvider,\n createRuntimeHttpProvider,\n type CredentialSource,\n} from '@alvin0/ai-agent-sdk-provider-http'\nimport {\n geminiInteractionsProtocol,\n type GeminiInteractionsDialect,\n} from '@alvin0/ai-agent-sdk-protocol-gemini-interactions'\n\n/** Google Gemini API v1beta base. The protocol appends only `/interactions`. */\nexport const GEMINI_BASE_URL = 'https://generativelanguage.googleapis.com/v1beta'\n\nexport type GeminiCredential = CredentialSource\n\nexport interface GeminiAdapterOptions {\n /** Injected API key or resolver. Universal packages never read environment variables. */\n apiKey: GeminiCredential\n /** Endpoint base; defaults to {@link GEMINI_BASE_URL}. */\n baseUrl?: string\n /** Advisory catalog. No model ids are built in, so the list cannot become stale. */\n models?: readonly ProviderCatalogModel[]\n /** Whether Google may retain interactions. Defaults to false. */\n store?: boolean\n defaultMaxTokens?: number\n defaultContextWindow?: number\n streamIdleTimeoutMs?: number\n requestTimeoutMs?: number\n maxRequestBytes?: number\n maxResponseBytes?: number\n maxResponseChunks?: number\n maxSseEvents?: number\n maxSseEventChars?: number\n maxErrorBodyBytes?: number\n requestLoggerTimeoutMs?: number\n retryPolicy?: RetryPolicyConfig\n requestLogger?: ProviderRequestLogger\n fetch?: typeof globalThis.fetch\n}\n\nexport function geminiAdapter(options: GeminiAdapterOptions): HttpModelAdapter {\n return createHttpProvider({\n displayName: 'Gemini',\n protocol: geminiInteractionsProtocol,\n baseUrl: options.baseUrl ?? GEMINI_BASE_URL,\n auth: {\n kind: 'header', name: 'x-goog-api-key', value: options.apiKey,\n label: 'the `apiKey` option',\n },\n dialect: dialectOf(options),\n ...(options.models === undefined ? {} : { models: options.models }),\n defaultMaxTokens: options.defaultMaxTokens ?? 8_192,\n defaultContextWindow: options.defaultContextWindow ?? 1_000_000,\n ...(options.streamIdleTimeoutMs === undefined ? {} : { streamIdleTimeoutMs: options.streamIdleTimeoutMs }),\n ...transportLimits(options),\n ...(options.retryPolicy === undefined ? {} : { retryPolicy: options.retryPolicy }),\n ...(options.requestLogger === undefined ? {} : { requestLogger: options.requestLogger }),\n })\n}\n\nexport interface GeminiPluginOptions extends GeminiAdapterOptions {\n /** Registry routes installed by the plugin. Defaults to `['gemini']`. */\n readonly routes?: readonly string[]\n}\n\nexport interface GeminiProviderOptions extends Omit<GeminiAdapterOptions, 'apiKey'> {\n readonly defaultModel?: string | ModelTarget\n readonly apiKey: CredentialInput\n readonly id?: string\n readonly routes?: readonly string[]\n}\n\nexport function geminiPlugin(\n options: GeminiProviderOptions,\n): ComposableModelProviderPlugin & { readonly family: 'gemini' }\nexport function geminiPlugin(options: GeminiPluginOptions): ModelProviderPlugin\nexport function geminiPlugin(\n options: GeminiProviderOptions | GeminiPluginOptions,\n): ModelProviderPlugin | (ComposableModelProviderPlugin & { readonly family: 'gemini' }) {\n if (!usesRuntimeComposition(options)) return legacyGeminiPlugin(options)\n const id = options.id ?? 'gemini'\n const routes = Object.freeze([...(options.routes ?? [id])])\n return defineModelProviderPlugin({\n id,\n family: 'gemini',\n displayName: 'Gemini',\n routes,\n ...runtimeDefaultModel(options.defaultModel, routes),\n setup(registrar) {\n const remove = registrar.registerAdapter(createRuntimeGeminiAdapter(options))\n return () => { remove(); return undefined }\n },\n }) as ComposableModelProviderPlugin & { readonly family: 'gemini' }\n}\n\nfunction legacyGeminiPlugin(options: GeminiPluginOptions): ModelProviderPlugin {\n const routes = Object.freeze([...(options.routes ?? ['gemini'])])\n const adapter = geminiAdapter(options)\n return Object.freeze({\n id: 'gemini',\n displayName: 'Gemini',\n setup(registrar: ModelProviderRegistrar) {\n registrar.registerAdapter(routes, adapter)\n },\n })\n}\n\nfunction createRuntimeGeminiAdapter(options: GeminiProviderOptions): HttpModelAdapter {\n return createRuntimeHttpProvider({\n displayName: 'Gemini',\n protocol: geminiInteractionsProtocol,\n baseUrl: options.baseUrl ?? GEMINI_BASE_URL,\n auth: {\n kind: 'header', name: 'x-goog-api-key', value: options.apiKey,\n label: 'the `apiKey` option',\n },\n dialect: dialectOf(options),\n ...(options.models === undefined ? {} : { models: options.models }),\n defaultMaxTokens: options.defaultMaxTokens ?? 8_192,\n defaultContextWindow: options.defaultContextWindow ?? 1_000_000,\n ...(options.streamIdleTimeoutMs === undefined ? {} : { streamIdleTimeoutMs: options.streamIdleTimeoutMs }),\n ...transportLimits(options),\n ...(options.retryPolicy === undefined ? {} : { retryPolicy: options.retryPolicy }),\n ...(options.requestLogger === undefined ? {} : { requestLogger: options.requestLogger }),\n })\n}\n\nfunction dialectOf(options: Pick<GeminiAdapterOptions, 'store'>): Partial<GeminiInteractionsDialect> {\n return options.store === undefined ? {} : { store: options.store }\n}\n\nfunction usesRuntimeComposition(\n options: GeminiProviderOptions | GeminiPluginOptions,\n): options is GeminiProviderOptions {\n if ('id' in options || 'defaultModel' in options) return true\n if (typeof options.apiKey === 'object' && options.apiKey !== null) return true\n if (typeof options.apiKey !== 'function') return true\n // Node's envCredential keeps a backwards-compatible callable surface while\n // also carrying the versioned CredentialSource marker used by composition.\n return 'kind' in options.apiKey && options.apiKey.kind === 'credential-source'\n}\n\nfunction runtimeDefaultModel(\n value: string | ModelTarget | undefined,\n routes: readonly string[],\n): { readonly defaultModel?: ModelTarget } {\n if (value === undefined) return {}\n if (typeof value !== 'string') return { defaultModel: value }\n if (routes.length !== 1) throw new TypeError('A string defaultModel requires exactly one Gemini route')\n return { defaultModel: Object.freeze({ provider: routes[0]!, id: value }) }\n}\n\nfunction transportLimits(options: GeminiAdapterOptions | GeminiProviderOptions) {\n return {\n ...(options.requestTimeoutMs === undefined ? {} : { requestTimeoutMs: options.requestTimeoutMs }),\n ...(options.maxRequestBytes === undefined ? {} : { maxRequestBytes: options.maxRequestBytes }),\n ...(options.maxResponseBytes === undefined ? {} : { maxResponseBytes: options.maxResponseBytes }),\n ...(options.maxResponseChunks === undefined ? {} : { maxResponseChunks: options.maxResponseChunks }),\n ...(options.maxSseEvents === undefined ? {} : { maxSseEvents: options.maxSseEvents }),\n ...(options.maxSseEventChars === undefined ? {} : { maxSseEventChars: options.maxSseEventChars }),\n ...(options.maxErrorBodyBytes === undefined ? {} : { maxErrorBodyBytes: options.maxErrorBodyBytes }),\n ...(options.requestLoggerTimeoutMs === undefined ? {} : { requestLoggerTimeoutMs: options.requestLoggerTimeoutMs }),\n ...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n }\n}\n"],"mappings":";;;;;;AAuBA,MAAa,kBAAkB;AA6B/B,SAAgB,cAAc,SAAiD;CAC7E,OAAO,mBAAmB;EACxB,aAAa;EACb,UAAUA;EACV,SAAS,QAAQ;EACjB,MAAM;GACJ,MAAM;GAAU,MAAM;GAAkB,OAAO,QAAQ;GACvD,OAAO;EACT;EACA,SAAS,UAAU,OAAO;EAC1B,GAAI,QAAQ,WAAW,SAAY,CAAC,IAAI,EAAE,QAAQ,QAAQ,OAAO;EACjE,kBAAkB,QAAQ,oBAAoB;EAC9C,sBAAsB,QAAQ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mB,QAAQ,kBAAkB;EAClG,GAAI,QAAQ,iBAAiB,SAAY,CAAC,IAAI,EAAE,cAAc,QAAQ,aAAa;EACnF,GAAI,QAAQ,qBAAqB,SAAY,CAAC,IAAI,EAAE,kBAAkB,QAAQ,iBAAiB;EAC/F,GAAI,QAAQ,sBAAsB,SAAY,CAAC,IAAI,EAAE,mBAAmB,QAAQ,kBAAkB;EAClG,GAAI,QAAQ,2BAA2B,SAAY,CAAC,IAAI,EAAE,wBAAwB,QAAQ,uBAAuB;EACjH,GAAI,QAAQ,UAAU,SAAY,CAAC,IAAI,EAAE,OAAO,QAAQ,MAAM;CAChE;AACF"}
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@alvin0/ai-agent-sdk-provider-gemini",
3
+ "author": {
4
+ "name": "alvin0 - chaulamdinhai",
5
+ "email": "chaulamdinhai@gmail.com"
6
+ },
7
+ "version": "0.1.0",
8
+ "description": "Universal Gemini Interactions adapter and provider plugin for ai-agent-sdk",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/alvin0/ai-agent-sdk.git",
13
+ "directory": "packages/provider-gemini"
14
+ },
15
+ "homepage": "https://github.com/alvin0/ai-agent-sdk/tree/main/packages/provider-gemini#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/alvin0/ai-agent-sdk/issues"
18
+ },
19
+ "type": "module",
20
+ "sideEffects": false,
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "main": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js",
32
+ "default": "./dist/index.js"
33
+ },
34
+ "./package.json": "./package.json"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public",
38
+ "provenance": true
39
+ },
40
+ "dependencies": {
41
+ "@alvin0/ai-agent-sdk-provider-http": "^0.1.0",
42
+ "@alvin0/ai-agent-sdk-protocol-gemini-interactions": "^0.1.0"
43
+ },
44
+ "peerDependencies": {
45
+ "@alvin0/ai-agent-sdk-core": "^0.1.0"
46
+ },
47
+ "devDependencies": {
48
+ "@alvin0/ai-agent-sdk-core": "^0.1.0",
49
+ "@alvin0/ai-agent-sdk-testkit": "^0.1.0",
50
+ "@arethetypeswrong/cli": "0.18.5",
51
+ "playwright": "1.62.1",
52
+ "publint": "0.3.24",
53
+ "tsdown": "0.22.14",
54
+ "typescript": "7.0.2",
55
+ "vitest": "4.1.11",
56
+ "wrangler": "4.127.1"
57
+ },
58
+ "aiAgentSdk": {
59
+ "runtime": "universal",
60
+ "coreApi": 1,
61
+ "roles": [
62
+ "model-provider"
63
+ ]
64
+ },
65
+ "scripts": {
66
+ "build": "tsdown",
67
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true});require('node:fs').rmSync('artifacts',{recursive:true,force:true})\"",
68
+ "typecheck": "tsc --noEmit",
69
+ "test": "vitest run --config vitest.config.ts",
70
+ "pack": "pnpm pack --pack-destination artifacts",
71
+ "test:pack": "node ../../scripts/test-packed-provider.mts provider-gemini",
72
+ "check:publint": "publint",
73
+ "check:types": "attw --profile esm-only --pack ."
74
+ }
75
+ }