opencode-agy-bridge 0.2.4 → 0.2.6

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
@@ -54,7 +54,7 @@ Add the plugin and provider to `~/.config/opencode/opencode.json`.
54
54
  ```jsonc
55
55
  {
56
56
  "plugin": [
57
- "opencode-agy-bridge@0.2.4"
57
+ "opencode-agy-bridge@0.2.6"
58
58
  ],
59
59
  "provider": {
60
60
  "agy": {
@@ -0,0 +1 @@
1
+ export default function unified(input?: any): any;
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ import { createAgyProvider } from "./provider.js";
2
+ export default function unified(input) {
3
+ if (input && typeof input === "object" && "client" in input) {
4
+ return {
5
+ config: async () => { },
6
+ "chat.headers": async (incoming, output) => {
7
+ if (incoming?.model?.providerID !== "agy")
8
+ return;
9
+ if (!output?.headers)
10
+ return;
11
+ output.headers["x-agy-session-id"] = incoming.sessionID;
12
+ },
13
+ };
14
+ }
15
+ return createAgyProvider(input);
16
+ }
@@ -1,4 +1,4 @@
1
- import type { ProviderV2, LanguageModelV2 } from "@ai-sdk/provider";
1
+ import type { ProviderV2 } from "@ai-sdk/provider";
2
2
  export interface AgyProviderOptions {
3
3
  binary?: string;
4
4
  conversationsDir?: string;
@@ -8,7 +8,6 @@ export interface AgyProviderOptions {
8
8
  }
9
9
  export declare function extractDelta(prevOutput: string, fullText: string, conversationBound: boolean): string;
10
10
  export declare function createAgyProvider(opts?: AgyProviderOptions): ProviderV2 & {
11
- (modelId: string): LanguageModelV2;
12
11
  provider: string;
13
12
  };
14
13
  export default function defaultFactory(opts?: AgyProviderOptions): ProviderV2;
package/dist/provider.js CHANGED
@@ -70,7 +70,6 @@ function buildLanguageModel(modelId, opts) {
70
70
  ? callOpts.prompt.slice(processedMessages)
71
71
  : callOpts.prompt;
72
72
  const prompt = flattenPrompt(newMessages);
73
- console.error("[agy-bridge] doGenerate session=%s conv=%s msgs=%d/%d", sessionId.slice(0, 8), conversationId?.slice(0, 8) ?? "-", newMessages.length, callOpts.prompt.length);
74
73
  const result = await runAgy({
75
74
  prompt,
76
75
  cwd: process.cwd(),
@@ -191,7 +190,6 @@ function buildLanguageModel(modelId, opts) {
191
190
  doStream,
192
191
  };
193
192
  }
194
- let factoryInitWarned = false;
195
193
  function unsupportedEmbeddingModel(modelId) {
196
194
  return {
197
195
  specificationVersion: "v2",
@@ -217,22 +215,17 @@ function unsupportedImageModel(modelId) {
217
215
  }
218
216
  export function createAgyProvider(opts) {
219
217
  const resolvedOpts = opts ?? {};
220
- if (!factoryInitWarned) {
221
- factoryInitWarned = true;
222
- console.error("[agy-bridge] createAgyProvider called");
223
- }
224
- const factory = (modelId) => {
225
- console.error("[agy-bridge] languageModel called for modelId=%s", modelId);
218
+ const languageModel = (modelId) => {
226
219
  return buildLanguageModel(modelId, resolvedOpts);
227
220
  };
228
- factory.provider = "agy";
229
- factory.specificationVersion = "v2";
230
- factory.languageModel = factory;
231
- factory.textEmbeddingModel = (modelId) => unsupportedEmbeddingModel(modelId);
232
- factory.imageModel = (modelId) => unsupportedImageModel(modelId);
233
- return factory;
221
+ return {
222
+ specificationVersion: "v2",
223
+ provider: "agy",
224
+ languageModel,
225
+ textEmbeddingModel: (modelId) => unsupportedEmbeddingModel(modelId),
226
+ imageModel: (modelId) => unsupportedImageModel(modelId),
227
+ };
234
228
  }
235
229
  export default function defaultFactory(opts) {
236
- console.error("[agy-bridge] defaultFactory called");
237
230
  return createAgyProvider(opts);
238
231
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "opencode-agy-bridge",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
- "main": "./dist/provider.js",
5
+ "main": "./dist/index.js",
6
6
  "license": "MIT",
7
7
  "description": "OpenCode plugin + provider that routes LLM prompts to agy (Google Antigravity CLI)",
8
8
  "exports": {
9
- ".": "./dist/provider.js",
9
+ ".": "./dist/index.js",
10
10
  "./provider": "./dist/provider.js",
11
11
  "./plugin": "./dist/plugin.js"
12
12
  },
package/plugin.js CHANGED
@@ -1,2 +1 @@
1
- export { default } from "./dist/plugin.js";
2
- export * from "./dist/plugin.js";
1
+ export { default } from "./dist/index.js";
package/provider.js CHANGED
@@ -1,2 +1 @@
1
- export { default } from "./dist/provider.js";
2
- export * from "./dist/provider.js";
1
+ export { default } from "./dist/index.js";