@agent-proxy/zcode 0.21.0 → 0.22.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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ModelCatalog } from "@agent-proxy/plugin-api";
1
+ import { type ModelCatalog } from "@agent-proxy/plugin-api";
2
2
  import type { ZcodeProviderSnapshot, ZcodeSelection } from "./config.ts";
3
3
  export declare function isZcodeModel(model: unknown): boolean;
4
4
  /** ZCode 对外模型 ID 的固定前缀族:旧 API Key 命名空间与各套餐作用域前缀。
package/dist/catalog.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from "node:fs";
2
1
  import { createHash } from "node:crypto";
2
+ import fs from "node:fs";
3
3
  import { getCodexBaselineEntry, getVendorModelPresets } from "./resources/models.js";
4
4
  import { atomicWrite } from "@agent-proxy/plugin-api";
5
5
  const vendorModelIds = () => (getVendorModelPresets()["z.ai"] ?? []).map((model) => model.name);
package/dist/config.js CHANGED
@@ -2,7 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { decryptZcodeCredential } from "./credential-cipher.js";
4
4
  import { readZcodeIndividualCredential } from "./individual-credentials.js";
5
- import { readZcodeIndividualProjectLocation, resolveZcodeIndividualApiKey, zcodeIndividualTokenFingerprint, ZcodeProjectTokenError, } from "./individual-project-token.js";
5
+ import { readZcodeIndividualProjectLocation, resolveZcodeIndividualApiKey, zcodeIndividualTokenFingerprint, ZcodeProjectTokenError } from "./individual-project-token.js";
6
6
  import { readZcodeTeamCredentialInputs, resolveZcodeTeamApiKey, } from "./team-credentials.js";
7
7
  export class ZcodeConfigError extends Error {
8
8
  }
@@ -1,4 +1,5 @@
1
- import type { ZcodeIdentity } from "./request-context.ts";
1
+ /** ZCode 端点动态重映射 — 复刻桌面客户端 3.7+ 的 ProviderEndpointRoutingService。 */
2
+ import { type ZcodeIdentity } from "./request-context.ts";
2
3
  export interface ZcodeEndpointRoutingOptions {
3
4
  identity: ZcodeIdentity;
4
5
  origin?: string;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- import type { HostServices, GatewayPlugin, ClientProtocol } from "@agent-proxy/plugin-api";
2
- import type { ZcodeConfigCache, ZcodeSelection } from "./config.ts";
3
- import { ZcodeEndpointRouting } from "./endpoint-routing.ts";
1
+ import { type ClientProtocol, type GatewayPlugin, type HostServices, type AgentConfig, type ModelCatalog, type ProcessLogTarget } from "@agent-proxy/plugin-api";
4
2
  import { ZcodeClientSigning } from "./client-signing.ts";
5
- import type { ZcodeIdentity } from "./request-context.ts";
6
- import type { AgentConfig, ModelCatalog, ProcessLogTarget } from "@agent-proxy/plugin-api";
3
+ import { type ZcodeConfigCache, type ZcodeSelection } from "./config.ts";
4
+ import { ZcodeEndpointRouting } from "./endpoint-routing.ts";
5
+ import { type ZcodeIdentity } from "./request-context.ts";
7
6
  export interface ZcodeDependencies {
8
7
  /** 目录管理层传入策略;manual 只在启动与显式命令发布模型变更。 */
9
8
  catalogMode?: "dynamic" | "manual";
package/dist/index.js CHANGED
@@ -1,21 +1,17 @@
1
- import { bindHostMethods, getHostServices, withHostServices } from "@agent-proxy/plugin-api";
2
- import path from "node:path";
3
1
  import { isIP } from "node:net";
4
- import { resolvePaths } from "@agent-proxy/plugin-api";
5
- import { createZcodeConfigCache, readZcodeAPIKeyProviders, zcodeConfigPresent, ZcodeConfigError } from "./config.js";
6
- import { clearModelsCacheEntries, invalidateModelsCache } from "@agent-proxy/plugin-api";
2
+ import path from "node:path";
3
+ import { bindHostMethods, clearModelsCacheEntries, getHostServices, invalidateModelsCache, localTime, logExchange, logGatewayError, logGroupFromPath, logRequestSummary, requestLogDir, resolvePaths, withHostServices } from "@agent-proxy/plugin-api";
7
4
  import { buildZcodeVendorCatalog, createZcodeCatalog, isZcodeModel, writeZcodeServedCatalog, zcodeAPIProviderIDFromModel, zcodeModelPlan, zcodeUpstreamModel, } from "./catalog.js";
5
+ import { clientSigningVerifyRejection, ZcodeClientSigning } from "./client-signing.js";
6
+ import { createZcodeConfigCache, readZcodeAPIKeyProviders, ZcodeConfigError, zcodeConfigPresent } from "./config.js";
7
+ import { ZcodeEndpointRouting } from "./endpoint-routing.js";
8
+ import { zcodeStartPlanEntitledFromLog } from "./plans.js";
9
+ import { buildZcodeModelHeaders, createZcodeContexts, decorateZcodeBody, readZcodeIdentity, zcodePlan } from "./request-context.js";
8
10
  import { translateZcodeRequest, ZcodeRequestError } from "./request.js";
9
11
  import { createZcodeClientResponse } from "./response.js";
12
+ import { createStartPlanFetch, dressZcodeStartPlanBody, startPlanUpstreamUrl, zcodeStartPlanRefusalHint } from "./start-plan-request.js";
10
13
  import { executeZcodeAnalyzeImage, matchZcodeAnalyzeImage } from "./vision.js";
11
- import { ZcodeEndpointRouting } from "./endpoint-routing.js";
12
- import { clientSigningVerifyRejection, ZcodeClientSigning } from "./client-signing.js";
13
14
  import { isZcodeRecord } from "./wire.js";
14
- import { buildZcodeModelHeaders, createZcodeContexts, decorateZcodeBody, readZcodeIdentity, zcodePlan } from "./request-context.js";
15
- import { createStartPlanFetch, dressZcodeStartPlanBody, startPlanUpstreamUrl, zcodeStartPlanRefusalHint } from "./start-plan-request.js";
16
- import { zcodeStartPlanEntitledFromLog } from "./plans.js";
17
- import { localTime, logExchange, logGroupFromPath, requestLogDir } from "@agent-proxy/plugin-api";
18
- import { logGatewayError, logRequestSummary } from "@agent-proxy/plugin-api";
19
15
  export function validateZcodeConfig(config) {
20
16
  const host = config.host;
21
17
  if (!(host === "localhost" || host === "::1" || host === "[::1]" || (isIP(host) === 4 && host.startsWith("127.")))) {
package/dist/request.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import { type ZcodeTranslatedRequest } from "./wire.ts";
1
2
  import type { ClientProtocol } from "@agent-proxy/plugin-api";
2
- import type { ZcodeTranslatedRequest } from "./wire.ts";
3
3
  /**
4
4
  * ZCode 请求准备:标准消息/工具/参数统一经 @agent-proxy/llm-bridge 的
5
5
  * convertRequest(to, "anthropic");z.ai 私有形状(web_search_20250305 服务端工具、
package/dist/request.js CHANGED
@@ -1,8 +1,8 @@
1
- import { BridgeConversionError, convertRequest, normalizeResponsesToolDeclarations, stripClientSystemPrompt } from "@agent-proxy/llm-bridge";
2
1
  import { createHash } from "node:crypto";
2
+ import { BridgeConversionError, convertRequest, normalizeResponsesToolDeclarations, stripClientSystemPrompt } from "@agent-proxy/llm-bridge";
3
3
  import { ZCODE_AGENT_SYSTEM_PROMPT } from "./request-context.js";
4
- import { decodeZcodeThinking, isZcodeRecord } from "./wire.js";
5
4
  import { ANALYZE_IMAGE_SYSTEM_NOTE, ANALYZE_IMAGE_TOOL_DECLARATION, ANALYZE_IMAGE_TOOL_NAME, collectZcodeImages } from "./vision.js";
5
+ import { decodeZcodeThinking, isZcodeRecord } from "./wire.js";
6
6
  /**
7
7
  * ZCode 请求准备:标准消息/工具/参数统一经 @agent-proxy/llm-bridge 的
8
8
  * convertRequest(to, "anthropic");z.ai 私有形状(web_search_20250305 服务端工具、
@@ -1,6 +1,6 @@
1
- import type { ClientProtocol } from "@agent-proxy/plugin-api";
2
- import { type ZcodeToolMap } from "./wire.ts";
3
1
  import { type ZcodeGatewayCall } from "./vision.ts";
2
+ import { type ZcodeToolMap } from "./wire.ts";
3
+ import type { ClientProtocol } from "@agent-proxy/plugin-api";
4
4
  /** 网关代执行工具(analyze_image)的驱动层钩子:执行调用并按需发起上游续跑。 */
5
5
  export interface ZcodeGatewayToolsHook {
6
6
  /** 执行一次被吸收的调用;返回作为 tool_result 呈给上游的文本。抛错时降级为错误说明文本。 */
package/dist/response.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createClientResponse, remapUndeclaredToolName } from "@agent-proxy/llm-bridge";
2
- import { encodeZcodeThinking, isZcodeRecord } from "./wire.js";
3
2
  import { gatewayToolCallNarration, gatewayToolResultNarration } from "./vision.js";
3
+ import { encodeZcodeThinking, isZcodeRecord } from "./wire.js";
4
4
  /** z.ai 的服务端搜索按 web_search_prime/search_query 形状返回 query;兼容 Anthropic 标准的 query。 */
5
5
  function serverToolQueryOf(input) {
6
6
  for (const key of ["search_query", "query"]) {
@@ -1,4 +1,4 @@
1
- import type { ZcodeIdentity, ZcodeRequestContext } from "./request-context.ts";
1
+ import { type ZcodeIdentity, type ZcodeRequestContext } from "./request-context.ts";
2
2
  import type { ZcodeFamily } from "./config.ts";
3
3
  /** start-plan 请求的形态输入;identity 提供平台信息与设备 ID,context 提供会话归因。 */
4
4
  export interface ZcodeStartPlanDressOptions {
@@ -19,11 +19,11 @@
19
19
  * - 官方文本与其余指纹数据同源维护(`fingerprint-data.json` 的
20
20
  * `startPlanPrompt` 与 `agentSystemPrompt`,各段 SHA-256 见测试)。
21
21
  */
22
- import fingerprintData from "./fingerprint-data.json";
23
- import { ZCODE_AGENT_SYSTEM_PROMPT } from "./request-context.js";
24
22
  import http from "node:http";
25
23
  import https from "node:https";
26
24
  import { Readable } from "node:stream";
25
+ import fingerprintData from "./fingerprint-data.json";
26
+ import { ZCODE_AGENT_SYSTEM_PROMPT } from "./request-context.js";
27
27
  const FINGERPRINT = fingerprintData;
28
28
  const PROMPT = FINGERPRINT.startPlanPrompt;
29
29
  function record(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-proxy/zcode",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Agent Proxy zcode 插件;保留基线转换行为。",
5
5
  "type": "module",
6
6
  "exports": {
@@ -35,11 +35,11 @@
35
35
  "url": "git+https://github.com/aceHubert/codex-cliproxy-gateway.git"
36
36
  },
37
37
  "devDependencies": {
38
- "@agent-proxy/models": "0.21.0"
38
+ "@agent-proxy/models": "0.22.0"
39
39
  },
40
40
  "dependencies": {
41
- "@agent-proxy/llm-bridge": "0.21.0",
42
- "@agent-proxy/plugin-api": "0.21.0"
41
+ "@agent-proxy/llm-bridge": "0.22.0",
42
+ "@agent-proxy/plugin-api": "0.22.0"
43
43
  },
44
- "gitHead": "59b68f3e371fec94cfc4854303e34fc5d8427e3b"
44
+ "gitHead": "27e9a7f2a14c18f7c42c9bc4ad083333b586705a"
45
45
  }