@agent-proxy/agy 0.17.0 → 0.19.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/dist/catalog.js CHANGED
@@ -2,9 +2,9 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { createHash } from "node:crypto";
4
4
  import { getCodexBaselineEntry } from "./resources/models.js";
5
- import { invalidateModelsCache, withAgentSystemPrompt } from "@agent-proxy/plugin-api";
5
+ import { invalidateModelsCache } from "@agent-proxy/plugin-api";
6
6
  import { atomicWrite } from "@agent-proxy/plugin-api";
7
- import { AGY_AGENT_SYSTEM_PROMPT, AGY_ENDPOINT } from "./transport.js";
7
+ import { AGY_ENDPOINT } from "./transport.js";
8
8
  import { THINKING_LEVELS } from "./request.js";
9
9
  /**
10
10
  * Antigravity 模型目录:`POST /v1internal:fetchAvailableModels` 拉取,以 `models`
@@ -238,7 +238,7 @@ export function buildAgyCatalog(data) {
238
238
  delete model.max_context_window;
239
239
  delete model.effective_context_window_percent;
240
240
  }
241
- return withAgentSystemPrompt(model, AGY_AGENT_SYSTEM_PROMPT);
241
+ return model;
242
242
  };
243
243
  const emitted = new Set();
244
244
  const models = [];
package/dist/index.js CHANGED
@@ -112,7 +112,7 @@ function buildAgyAdapter(config, dependencies = {}) {
112
112
  async catalog() {
113
113
  if (closed)
114
114
  return { models: [] };
115
- // 系统提示词已在 buildAgyCatalog 合成时替换(含 model_messages 模板),缓存即成品。
115
+ // 目录缓存即成品(官方提示词由请求转换层整体注入,任何客户端协议进入均生效)。
116
116
  return { models: (await loadCatalogMeta()) ?? [] };
117
117
  },
118
118
  /** 显式刷新不吞错;无 last-good 时由命令报告失败。 */
package/dist/request.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import { AGY_DEFAULT_PROJECT } from "./transport.js";
2
+ import { AGY_AGENT_SYSTEM_PROMPT, AGY_DEFAULT_PROJECT } from "./transport.js";
3
3
  /**
4
4
  * Codex Responses → Antigravity v1internal generateContent 请求转换。
5
5
  *
@@ -90,24 +90,6 @@ function safeToolName(name) {
90
90
  function textPart(value, field) {
91
91
  return { text: string(value.text, `${field}.text`) };
92
92
  }
93
- function systemText(value, field) {
94
- if (typeof value === "string")
95
- return value;
96
- if (!Array.isArray(value))
97
- fail(`${field} 必须是字符串或内容数组`);
98
- const parts = [];
99
- for (const raw of value) {
100
- if (!record(raw))
101
- fail(`${field} 包含无效内容块`);
102
- if (raw.type === "input_text" || raw.type === "output_text" || raw.type === "text") {
103
- parts.push(string(raw.text, `${field}.text`));
104
- }
105
- else {
106
- fail(`${field} 的 system 内容不支持图片等非文本块`);
107
- }
108
- }
109
- return parts.join("\n\n");
110
- }
111
93
  function toolIdentity(rawName, rawNamespace) {
112
94
  const original = string(rawName, "工具 name");
113
95
  if (!original)
@@ -604,8 +586,9 @@ export function translateAgyRequest(body, upstreamModel, to = "responses") {
604
586
  }
605
587
  if (item.type === "message" || item.type === undefined) {
606
588
  if (item.role === "system" || item.role === "developer") {
589
+ // 客户端系统级内容整体替换为官方 AGY 提示词(catalog 不再注入,任何
590
+ // 客户端协议进入都在转换层统一注入),不再收集进 system。
607
591
  pendingAssistant = undefined;
608
- system.push(systemText(item.content, `${item.role} 消息`));
609
592
  continue;
610
593
  }
611
594
  if (item.role !== "user" && item.role !== "assistant")
@@ -736,9 +719,9 @@ export function translateAgyRequest(body, upstreamModel, to = "responses") {
736
719
  }
737
720
  const inner = {
738
721
  contents,
739
- ...(system.length || body.instructions !== undefined ? {
740
- systemInstruction: { role: "user", parts: [...(body.instructions !== undefined ? [{ text: body.instructions }] : []), ...system.map((text) => ({ text }))] },
741
- } : {}),
722
+ // 官方 AGY 提示词为 systemInstruction 唯一基底;客户端 instructions 与
723
+ // system/developer 内容已剥离,网关旁白(dropped 工具通告)接在其后。
724
+ systemInstruction: { role: "user", parts: [{ text: AGY_AGENT_SYSTEM_PROMPT }, ...system.map((text) => ({ text }))] },
742
725
  ...(convertedTools.tools.length ? { tools: [{ functionDeclarations: convertedTools.tools }] } : {}),
743
726
  generationConfig,
744
727
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-proxy/agy",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Agent Proxy agy 插件;保留基线转换行为。",
5
5
  "type": "module",
6
6
  "exports": {
@@ -35,10 +35,10 @@
35
35
  "url": "git+https://github.com/aceHubert/codex-cliproxy-gateway.git"
36
36
  },
37
37
  "devDependencies": {
38
- "@agent-proxy/models": "0.17.0"
38
+ "@agent-proxy/models": "0.19.0"
39
39
  },
40
40
  "dependencies": {
41
- "@agent-proxy/plugin-api": "0.17.0"
41
+ "@agent-proxy/plugin-api": "0.19.0"
42
42
  },
43
- "gitHead": "7dc26953606d78cc982692de2f830f9f92061adc"
43
+ "gitHead": "20dff92139f68670155c173ba94849415c7ef21e"
44
44
  }