@opencode/ai 0.0.0-dev-20788 → 0.0.0-dev-20789
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 +7 -1
- package/dist/providers/google-vertex/interactions.d.ts +2 -0
- package/dist/providers/google-vertex/interactions.js +1 -0
- package/dist/providers/google-vertex-interactions.d.ts +112 -0
- package/dist/providers/google-vertex-interactions.js +64 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.js +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -32,6 +32,11 @@ Anthropic Messages, Gemini, Bedrock Converse, and any OpenAI-compatible deployme
|
|
|
32
32
|
`Google.configure({ apiKey }).interactions(modelID)` selects the Interactions API; `.model(modelID)` still selects
|
|
33
33
|
GenerateContent. The package entrypoint is `@opencode/ai/providers/google/interactions`.
|
|
34
34
|
|
|
35
|
+
For Vertex AI, use `GoogleVertexInteractions.configure({ project, location: "global" }).model(modelID)` or
|
|
36
|
+
`@opencode/ai/providers/google-vertex/interactions`. It uses Application Default Credentials by default, accepts
|
|
37
|
+
an explicit `accessToken` or `auth` override, and supports Express mode with `apiKey`. Vertex metadata and raw usage
|
|
38
|
+
live under `providerMetadata.vertex`. The default is still full-history replay with `store: false`.
|
|
39
|
+
|
|
35
40
|
```ts
|
|
36
41
|
const model = Google.configure({ apiKey }).interactions("gemini-3.8-flash")
|
|
37
42
|
const response = yield* LLM.generate({
|
|
@@ -1316,13 +1321,14 @@ APIs have separate entrypoints:
|
|
|
1316
1321
|
- `@opencode/ai/providers/openai-compatible/responses`
|
|
1317
1322
|
- `@opencode/ai/providers/anthropic-compatible`
|
|
1318
1323
|
- `@opencode/ai/providers/google-vertex/gemini`
|
|
1324
|
+
- `@opencode/ai/providers/google-vertex/interactions`
|
|
1319
1325
|
- `@opencode/ai/providers/google-vertex/chat`
|
|
1320
1326
|
- `@opencode/ai/providers/google-vertex/responses`
|
|
1321
1327
|
- `@opencode/ai/providers/google-vertex/messages`
|
|
1322
1328
|
|
|
1323
1329
|
OpenAI Responses has one semantic route and uses HTTP by default. Advanced callers may supply a per-call WebSocket channel executor through `StreamOptions`; transport policy does not change provider settings, model identity, or route identity. The provider-neutral Open Responses implementation owns the reusable WebSocket request and event contract, while each provider opts in with its own handshake and connection policy. Azure follows the same Chat/Responses split at `providers/azure/chat` and `providers/azure/responses`. Generic OpenAI-compatible Chat remains at `providers/openai-compatible`; the Responses adapter at `providers/openai-compatible/responses` uses the provider-neutral Open Responses protocol. OpenAI Responses extends that baseline with OpenAI tools, event variants, metadata, and defaults. Generic Anthropic Messages-compatible providers use `providers/anthropic-compatible`, which the named Anthropic provider composes. Google Gemini and Amazon Bedrock expose their single native API through their existing provider paths.
|
|
1324
1330
|
|
|
1325
|
-
Vertex Gemini, Vertex Chat, Vertex Responses, and Vertex Messages are separate API entrypoints. All accept `project`, `location`, and an optional `accessToken`; when no explicit token or auth override is supplied they lazily use Google Application Default Credentials. Vertex Gemini instead
|
|
1331
|
+
Vertex Gemini, Vertex Interactions, Vertex Chat, Vertex Responses, and Vertex Messages are separate API entrypoints. All accept `project`, `location`, and an optional `accessToken`; when no explicit token or auth override is supplied they lazily use Google Application Default Credentials. Vertex Gemini and Interactions instead select express mode when `apiKey` or `GOOGLE_VERTEX_API_KEY` is present (explicit `project` or `location` selects ADC over an ambient key). Vertex Chat targets MaaS models through the OpenAI-compatible Chat Completions endpoint, while Vertex Responses targets Grok models and defaults `store` to `false` as required by Vertex. `providers/google-vertex` remains the default alias for `providers/google-vertex/gemini`.
|
|
1326
1332
|
|
|
1327
1333
|
Tuned Vertex Gemini deployments use model ids shaped like `endpoints/1234567890` and require OAuth or ADC; Vertex express-mode API keys support publisher models only.
|
|
1328
1334
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { model } from "../google-vertex-interactions.js";
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
+
import { GoogleInteractions } from "../protocols/google-interactions.js";
|
|
3
|
+
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
4
|
+
import { type ModelID } from "../schema/index.js";
|
|
5
|
+
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
6
|
+
export type GoogleInteractionsOptionsInput = GoogleInteractions.OptionsInput;
|
|
7
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
8
|
+
export type Config = RouteDefaultsInput & GoogleVertexShared.ApiKeyOptions & {
|
|
9
|
+
readonly baseURL?: string;
|
|
10
|
+
readonly location?: string;
|
|
11
|
+
readonly project?: string;
|
|
12
|
+
readonly providerOptions?: GoogleInteractions.ProviderOptionsInput;
|
|
13
|
+
};
|
|
14
|
+
export type Settings = ProviderPackage.Settings & GoogleInteractions.ProviderOptionsInput & ({
|
|
15
|
+
readonly accessToken?: string;
|
|
16
|
+
readonly apiKey?: never;
|
|
17
|
+
} | {
|
|
18
|
+
readonly accessToken?: never;
|
|
19
|
+
readonly apiKey?: string;
|
|
20
|
+
}) & {
|
|
21
|
+
readonly baseURL?: string;
|
|
22
|
+
readonly location?: string;
|
|
23
|
+
readonly project?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const routes: Route<{
|
|
26
|
+
readonly input: readonly ({
|
|
27
|
+
readonly type: "user_input" | "model_output";
|
|
28
|
+
readonly content: readonly ({
|
|
29
|
+
readonly type: "text";
|
|
30
|
+
readonly text: string;
|
|
31
|
+
} | {
|
|
32
|
+
readonly type: "image" | "document" | "video" | "audio";
|
|
33
|
+
readonly mime_type: string;
|
|
34
|
+
readonly data?: string | undefined;
|
|
35
|
+
readonly uri?: string | undefined;
|
|
36
|
+
})[];
|
|
37
|
+
} | {
|
|
38
|
+
readonly type: "thought";
|
|
39
|
+
readonly summary?: readonly {
|
|
40
|
+
readonly type: "text";
|
|
41
|
+
readonly text: string;
|
|
42
|
+
}[] | undefined;
|
|
43
|
+
readonly signature?: string | undefined;
|
|
44
|
+
} | {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly type: "function_call";
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly arguments: unknown;
|
|
49
|
+
readonly signature?: string | undefined;
|
|
50
|
+
} | {
|
|
51
|
+
readonly type: "function_result";
|
|
52
|
+
readonly name: string;
|
|
53
|
+
readonly result: unknown;
|
|
54
|
+
readonly call_id: string;
|
|
55
|
+
readonly is_error?: boolean | undefined;
|
|
56
|
+
})[];
|
|
57
|
+
readonly model: string;
|
|
58
|
+
readonly stream: true;
|
|
59
|
+
readonly store: boolean;
|
|
60
|
+
readonly generation_config: {
|
|
61
|
+
readonly temperature?: number | undefined;
|
|
62
|
+
readonly seed?: number | undefined;
|
|
63
|
+
readonly tool_choice?: "auto" | "none" | "any" | {
|
|
64
|
+
readonly allowed_tools: {
|
|
65
|
+
readonly mode: "any";
|
|
66
|
+
readonly tools: readonly string[];
|
|
67
|
+
};
|
|
68
|
+
} | undefined;
|
|
69
|
+
readonly top_p?: number | undefined;
|
|
70
|
+
readonly stop_sequences?: readonly string[] | undefined;
|
|
71
|
+
readonly max_output_tokens?: number | undefined;
|
|
72
|
+
readonly thinking_level?: import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high"> | undefined;
|
|
73
|
+
readonly thinking_summaries?: string | undefined;
|
|
74
|
+
};
|
|
75
|
+
readonly tools?: readonly {
|
|
76
|
+
readonly type: "function";
|
|
77
|
+
readonly name: string;
|
|
78
|
+
readonly description: string;
|
|
79
|
+
readonly parameters: {
|
|
80
|
+
readonly [x: string]: unknown;
|
|
81
|
+
};
|
|
82
|
+
}[] | undefined;
|
|
83
|
+
readonly service_tier?: string | undefined;
|
|
84
|
+
readonly previous_interaction_id?: string | undefined;
|
|
85
|
+
readonly system_instruction?: string | undefined;
|
|
86
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
87
|
+
export declare const configure: (input?: Config) => {
|
|
88
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
89
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
90
|
+
readonly serviceTier?: import("../schema/options.js").OpenString<"standard" | "flex" | "priority" | "deferred"> | undefined;
|
|
91
|
+
readonly thinkingLevel?: import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high"> | undefined;
|
|
92
|
+
readonly previousInteractionId?: string | undefined;
|
|
93
|
+
readonly store?: boolean | undefined;
|
|
94
|
+
readonly thinkingSummaries?: import("../schema/options.js").OpenString<"auto" | "none"> | undefined;
|
|
95
|
+
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
96
|
+
configure: (input?: Config) => /*elided*/ any;
|
|
97
|
+
};
|
|
98
|
+
export declare const provider: {
|
|
99
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
100
|
+
configure: (input?: Config) => {
|
|
101
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
102
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
103
|
+
readonly serviceTier?: import("../schema/options.js").OpenString<"standard" | "flex" | "priority" | "deferred"> | undefined;
|
|
104
|
+
readonly thinkingLevel?: import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high"> | undefined;
|
|
105
|
+
readonly previousInteractionId?: string | undefined;
|
|
106
|
+
readonly store?: boolean | undefined;
|
|
107
|
+
readonly thinkingSummaries?: import("../schema/options.js").OpenString<"auto" | "none"> | undefined;
|
|
108
|
+
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
109
|
+
configure: /*elided*/ any;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export declare const model: ProviderPackage.Definition<Settings, GoogleInteractions.ProviderOptionsInput>["model"];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { GoogleInteractions } from "../protocols/google-interactions.js";
|
|
2
|
+
import { Auth } from "../route/auth.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { Endpoint } from "../route/endpoint.js";
|
|
5
|
+
import { Framing } from "../route/framing.js";
|
|
6
|
+
import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
|
|
7
|
+
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
8
|
+
export const id = ProviderID.make("google-vertex");
|
|
9
|
+
const route = Route.make({
|
|
10
|
+
id: "google-vertex-interactions",
|
|
11
|
+
provider: id,
|
|
12
|
+
providerMetadataKey: "vertex",
|
|
13
|
+
protocol: GoogleInteractions.protocol,
|
|
14
|
+
endpoint: Endpoint.path("/interactions", { query: { alt: "sse" } }),
|
|
15
|
+
auth: Auth.none,
|
|
16
|
+
headers: ({ request }) => {
|
|
17
|
+
const serviceTier = request.providerOptions?.serviceTier;
|
|
18
|
+
return typeof serviceTier === "string" ? { "x-vertex-ai-llm-shared-request-type": serviceTier } : {};
|
|
19
|
+
},
|
|
20
|
+
framing: Framing.sse,
|
|
21
|
+
});
|
|
22
|
+
export const routes = [route];
|
|
23
|
+
const configuredRoute = (input) => {
|
|
24
|
+
const { accessToken: _accessToken, apiKey: _apiKey, auth: _auth, baseURL, location: inputLocation, project: inputProject, ...rest } = input;
|
|
25
|
+
const apiKey = GoogleVertexShared.apiKey(input);
|
|
26
|
+
const location = GoogleVertexShared.location(inputLocation, "global");
|
|
27
|
+
const project = GoogleVertexShared.project(inputProject);
|
|
28
|
+
return route.with({
|
|
29
|
+
...rest,
|
|
30
|
+
endpoint: {
|
|
31
|
+
baseURL: baseURL ??
|
|
32
|
+
`https://${GoogleVertexShared.host(location)}/v1beta1/${apiKey === undefined ? `projects/${GoogleVertexShared.requireProject(project)}/` : ""}locations/${location}`,
|
|
33
|
+
},
|
|
34
|
+
auth: apiKey === undefined ? GoogleVertexShared.oauth(input, project) : Auth.header("x-goog-api-key", apiKey),
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export const configure = (input = {}) => {
|
|
38
|
+
const route = configuredRoute(input);
|
|
39
|
+
return {
|
|
40
|
+
id,
|
|
41
|
+
model: (modelID) => route.model({ id: modelID }),
|
|
42
|
+
configure,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export const provider = {
|
|
46
|
+
id,
|
|
47
|
+
configure,
|
|
48
|
+
};
|
|
49
|
+
export const model = (modelID, { accessToken, apiKey, baseURL, body, headers, location, project, ...providerOptions }) => {
|
|
50
|
+
if (apiKey !== undefined && accessToken !== undefined)
|
|
51
|
+
throw new ProviderConfigurationError({
|
|
52
|
+
provider: id,
|
|
53
|
+
message: "Google Vertex apiKey cannot be combined with accessToken or auth",
|
|
54
|
+
});
|
|
55
|
+
return configure({
|
|
56
|
+
...(apiKey === undefined ? { accessToken } : { apiKey }),
|
|
57
|
+
baseURL,
|
|
58
|
+
headers,
|
|
59
|
+
http: body === undefined ? undefined : { body },
|
|
60
|
+
location,
|
|
61
|
+
project,
|
|
62
|
+
providerOptions,
|
|
63
|
+
}).model(modelID);
|
|
64
|
+
};
|
|
@@ -22,6 +22,7 @@ export * as Fireworks from "./fireworks.js";
|
|
|
22
22
|
export * as Google from "./google.js";
|
|
23
23
|
export * as GoogleVertex from "./google-vertex.js";
|
|
24
24
|
export * as GoogleVertexChat from "./google-vertex-chat.js";
|
|
25
|
+
export * as GoogleVertexInteractions from "./google-vertex-interactions.js";
|
|
25
26
|
export * as GoogleVertexMessages from "./google-vertex-messages.js";
|
|
26
27
|
export * as GoogleVertexMistral from "./google-vertex-mistral.js";
|
|
27
28
|
export * as GoogleVertexResponses from "./google-vertex-responses.js";
|
package/dist/providers/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export * as Fireworks from "./fireworks.js";
|
|
|
22
22
|
export * as Google from "./google.js";
|
|
23
23
|
export * as GoogleVertex from "./google-vertex.js";
|
|
24
24
|
export * as GoogleVertexChat from "./google-vertex-chat.js";
|
|
25
|
+
export * as GoogleVertexInteractions from "./google-vertex-interactions.js";
|
|
25
26
|
export * as GoogleVertexMessages from "./google-vertex-messages.js";
|
|
26
27
|
export * as GoogleVertexMistral from "./google-vertex-mistral.js";
|
|
27
28
|
export * as GoogleVertexResponses from "./google-vertex-responses.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20789",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
36
36
|
"@effect/platform-node": "4.0.0-rc.118",
|
|
37
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
37
|
+
"@opencode/http-recorder": "0.0.0-dev-20789",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
45
45
|
"@smithy/eventstream-codec": "4.2.14",
|
|
46
46
|
"@smithy/util-utf8": "4.2.2",
|
|
47
|
-
"@opencode/schema": "0.0.0-dev-
|
|
47
|
+
"@opencode/schema": "0.0.0-dev-20789",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.0-rc.118",
|
|
50
50
|
"google-auth-library": "10.5.0"
|