@agent-proxy/agy 0.19.0 → 0.20.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.
Files changed (2) hide show
  1. package/dist/request.js +40 -0
  2. package/package.json +4 -4
package/dist/request.js CHANGED
@@ -629,6 +629,46 @@ export function translateAgyRequest(body, upstreamModel, to = "responses") {
629
629
  (item.role === "assistant" ? assistantContent() : userContent()).parts.push(...parts);
630
630
  continue;
631
631
  }
632
+ if (item.type === "agent_message") {
633
+ // Codex 多智能体历史:agent 产出的消息(author/recipient 为内部路由元数据)
634
+ // 按 assistant 回放文本与图片;encrypted_content 是上游私有加密载荷,跨厂商
635
+ // 不可解,直接剥离。
636
+ const parts = [];
637
+ const content = item.content;
638
+ if (typeof content === "string")
639
+ parts.push({ text: content });
640
+ else if (Array.isArray(content)) {
641
+ for (const raw of content) {
642
+ if (!record(raw))
643
+ fail("agent_message 包含无效内容块");
644
+ if (raw.type === "encrypted_content")
645
+ continue;
646
+ if (raw.type === "input_text" || raw.type === "output_text" || raw.type === "text")
647
+ parts.push(textPart(raw, "agent_message"));
648
+ else if (raw.type === "input_image" || raw.type === "image") {
649
+ const source = raw.image_url ?? raw.url;
650
+ const url = typeof source === "string" ? source : record(source) ? source.url : undefined;
651
+ if (typeof url !== "string" || !url)
652
+ fail("agent_message 的 input_image 缺少 image_url");
653
+ if (url.startsWith("data:")) {
654
+ const match = /^data:([^;,]*)(?:;charset=[^;,]*)?;base64,(.*)$/s.exec(url);
655
+ if (!match)
656
+ fail("agent_message 的 data URI 必须是 base64 编码");
657
+ parts.push({ inlineData: { mimeType: match[1] || "image/png", data: match[2] } });
658
+ }
659
+ else {
660
+ parts.push({ fileData: { fileUri: url } });
661
+ }
662
+ }
663
+ else
664
+ fail(`agent_message 包含不支持的内容块类型 ${String(raw.type)}`);
665
+ }
666
+ }
667
+ else
668
+ fail("agent_message 的 content 必须是字符串或数组");
669
+ assistantContent().parts.push(...parts);
670
+ continue;
671
+ }
632
672
  if (item.type === "function_call" || item.type === "custom_tool_call") {
633
673
  const identity = toolIdentity(item.name, item.namespace);
634
674
  const custom = item.type === "custom_tool_call";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-proxy/agy",
3
- "version": "0.19.0",
3
+ "version": "0.20.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.19.0"
38
+ "@agent-proxy/models": "0.20.0"
39
39
  },
40
40
  "dependencies": {
41
- "@agent-proxy/plugin-api": "0.19.0"
41
+ "@agent-proxy/plugin-api": "0.20.0"
42
42
  },
43
- "gitHead": "20dff92139f68670155c173ba94849415c7ef21e"
43
+ "gitHead": "52d36d18816a077ef2861bf3b5479a7dbd95108c"
44
44
  }