@kanyun-ai-infra/agenthub 1.30.0 → 1.32.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/CHANGELOG.md CHANGED
@@ -4,6 +4,43 @@
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 1.32.0
8
+
9
+ 本版整理 1.31.0 之后已合入的模型价目读面、工作负载生命周期配置读写、会话 MCP 透传头、会话列表 `lifecyclePhase` 与 OpenAI 协议 `baseUrl` 校验。SDK 接受输入和解析响应,不代表服务端已部署或能力已启用;`models.listPrices`、`lifecycle-config` 与 `mcpPassthrough` 需要服务端已部署对应能力。1.31.0 因 GitHub Actions 账单拦截从未发布到 npm(run 43320982593,a4344e8ce),本版包含 1.31.0 的全部内容,npm 上直接从 1.30.0 升到 1.32.0。
10
+
11
+ ### 新增 API 与类型(主入口)
12
+
13
+ - 新增 `models.listPrices({ signal? })`,对应 `GET /api/model-prices`,返回 `{ prices }`:当前带 `maxCostUsd` 的回合能计价的模型及其每百万 token 价格(币种按行,`provisional: true` 为厂商公开价)。回合预算前先查此表,缺价模型发 `maxCostUsd` 会得到 400 `BUDGET_UNPRICED`。需要 `runs:create`。新增类型导出 `ModelPrice` / `ModelPricesResponse`。
14
+ - 新增 `workloads.getLifecycleConfig({ projectId, workloadId }, { signal? })` 与 `workloads.putLifecycleConfig({ projectId, workloadId }, update, { signal? })`(`agents.*` 同名别名,`agentId` 等价于 `workloadId`),对应 `GET|PUT /api/workloads/{id}/lifecycle-config`。`workloadId` 可传工作负载 UUID 或 slug。读返回 `{ workloadId, kind, config, effective }`:`config` 是各字段的覆盖值(`null` 表示未覆盖),`effective` 是套用平台默认后的生效值。写是局部更新:只写传入的键,`null` 清除覆盖,`{}` 不改字段但会刷新 `updatedAt`;`idleAfterSeconds` 300–86400、`idleGraceSeconds` 60–3600、`maxSessionLifetimeMs` 3600000–604800000,越界或未知键在发请求前抛 `PilotPlatformApiError`(`VALIDATION_ERROR`,status 0)。读需要 `agents:read`、写需要 `agents:write`,且调用方须是该项目协作者;项目不在 token 范围返回 403 `PROJECT_NOT_IN_TOKEN_SCOPE`,非协作者 403 `FORBIDDEN`,工作负载不存在 404 `WORKLOAD_NOT_FOUND`。新增类型导出 `WorkloadLifecycleConfig` / `WorkloadLifecycleConfigResponse` / `WorkloadLifecycleConfigUpdate` / `EffectiveWorkloadLifecycleConfig` / `WorkloadLifecycleConfigInput`。服务端需已部署该路由。
15
+ - `sessions.create` 的请求(`CreateSessionRequestInput`)新增可选 `mcpPassthrough: [{ targetUrl, headers }]`(#6168),为指定上游 MCP 目标声明由平台注入的业务请求头。声明在建会话时冻结,由网关在服务端注入每个发往该目标的请求,沙箱内的模型无法伪造或修改,信任级别同 `user.id`。每个 `targetUrl` 必须与该会话允许的 MCP 目标之一完全一致,否则返回 400 `SESSION_MCP_PASSTHROUGH_TARGET_NOT_FOUND`;保留头名(`authorization`、`x-pilot-*` 等)在创建时被拒,与凭据自带的 `authorization` / `customHeaders` 重名时以凭据为准。仅 `managed_agent` 会话可用;带该声明的请求不使用预热池。需要服务端已部署该能力。
16
+ - `sessions.list` 返回的列表项新增可选 `lifecyclePhase`(#6198):会话回收轴的当前阶段(字符串或 `null`),旧服务端缺省该键时解析为 `undefined`。判断会话是否仍可直连请看 `lifecyclePhase`,不要只看 `status`。
17
+
18
+ ### 客户端行为
19
+
20
+ - `modelServices.create` 的 `wireApi: "openai_chat_completions"` 分支要求 `baseUrl` 以版本段 `/v<数字>` 结尾(可带尾斜杠,保存时去掉),例如 `http://nlp.zhenguanyu.com/api/nlp-llm-pro-vision-server/v1`;不满足时在发请求前校验失败,错误信息给出正确写法(#6124)。服务端对更新请求修改 OpenAI 协议服务 `baseUrl` 的情况同判,返回 400 `llm_provider_config_invalid_base_url`;不修改 `baseUrl` 的更新不受影响。
21
+
22
+ ## 1.31.0
23
+
24
+ 本版整理 1.30.0 之后已合入的会话列表、模型服务协议、GCP 网络凭据与评测摘要公开面变化。SDK 接受输入和解析响应,不代表服务端已部署或能力已启用;GCP 服务账号写入仍受服务端开关控制,尚无真实 Google 调用或生产开旗验收。
25
+
26
+ ### 新增 API 与类型(主入口)
27
+
28
+ - 新增 `sessions.list({ workloadId, user?, limit?, cursor? }, { signal? })`(#6134),返回 `{ items, nextCursor }`。`user` 按终端用户身份精确筛选,默认每页 50 条、最多 200 条,按最新会话优先分页;用上一页的 `nextCursor` 继续查询。新增值导出 `ListPlatformSessionsQuerySchema` / `ListPlatformSessionsResponseSchema`,以及类型 `ListPlatformSessionsQuery` / `ListPlatformSessionsResponse` / `PlatformSessionListItem`;列表项包含 `user` 与 `memorySubjects`。
29
+ - `modelServices.create` 的既有请求类型与 schema 新增 `wireApi: "openai_chat_completions"` 分支(#6130):仅接受 Bearer 鉴权,至少指定一个默认模型,不接受 `thinkingDialect`,`baseUrl` 不含 `/chat/completions` 或 `/responses` 端点路径。省略该输入仍沿用既有 Anthropic 分支;`modelServices` 的返回值仍是标识与状态摘要。
30
+ - `vaults.credentials.create` 的 `CreateCredentialRequest` 与 `vaults.credentials.update` 的既有请求类型接受 `auth.gcp: { projectId, clientEmail, privateKey }`(#6101),用于 `net_secret` 网络凭据。`gcp` 与 `accessToken` 互斥;GCP 创建请求省略 `inject`,域名限 Vertex AI 主机。`VaultCredentialRecord` 的网络凭据臂新增 `scheme: "static" | "gcp_service_account"`;GCP 读面仅公开 `gcp: { projectId, clientEmail }`,不返回私钥。
31
+ - `evals.listRuns` / `evals.getRun` 的既有响应类型中,`summary` 新增可选非负整数字段 `unjudged`(#6118),表示声明但尚无判定结果的 case 数;旧响应不带该字段仍可解析。
32
+
33
+ ### 客户端行为
34
+
35
+ - 网络凭据响应缺少 `scheme` 时补为 `"static"`,兼容旧服务端静态行;已知 `net_secret` 类型带未知 `scheme` 时拒绝解析,不作为未知凭据类型放行(#6101)。GCP 响应会剥除非公开字段;update 不接受修改 `envName`、`domains` 或 `inject`。
36
+
37
+ ### 随包文档与服务端语义
38
+
39
+ - 会话列表要求服务端提供列表端点并授予 `runs:stream`;不可访问与不存在的 workload 同为 404 `WORKLOAD_NOT_FOUND`,坏 cursor 返回 400 `INVALID_SESSION_CURSOR`。服务端排除预热库存与评测会话,保留已领取的池会话(#6134)。
40
+ - OpenAI Chat Completions 模型服务在当前服务端契约中仅允许 `format: live` 绑定,不能用于 `claude_code`、`pi` 等执行器;安装 SDK 不扩大执行器兼容范围(#6130)。
41
+ - README 与随包 SKILL 补充 GCP 网络凭据录入、整体轮换与非密读面(#6101)。服务端写入未启用时返回 400 `vault_credential_gcp_not_enabled`;运行时转发另依赖 gateway 的 GCP 支持。本版不证明服务端到达、开关启用、Vertex Lyria 可用或真实 Google 调用成功。
42
+ - 评测运行提前收口、已记录 suite 声明 case 数且仍有未判定 case 时,服务端返回 `unjudged > 0`,`total` 为声明数,已判定数为 `total - unjudged`,`gatePass` 为 `false`(#6118)。字段缺省既可能表示全部判完,也可能是未记录声明数的历史运行,不能仅凭缺省认定全部完成。
43
+
7
44
  ## 1.30.0
8
45
 
9
46
  本版整理 1.29.0 之后已合入的 SDK 改动。新增 API 与客户端行为列在下方;凭据撤销的说明描述服务端契约,不代表安装本版即可启用,也不证明服务端部署、权限签发、运行时能力或真实调用已验证。GCP 网络凭据不在本版范围。
package/README.md CHANGED
@@ -528,3 +528,23 @@ Use `client.credentialEntryTickets.create(projectId, { target, returnUrl, ttlSec
528
528
  Read `result.url` explicitly to hand it to an administrator; JSON serialization and Node inspect hide it. Never log the link or HTTP body. Filling still requires portal CAS login and project management permission; this resource has no fill method. `get(projectId, ticketId)` and `revoke(projectId, ticketId)` return `{ticketId, status, expiresAt}` and require the issuer's current write scope and project access.
529
529
 
530
530
  With an idempotency key, pending retries return the same ID, URL and expiry; different request bytes return 409. Terminal or expired retries return 410 without a URL. The key is retained as a capability-free tombstone for 24 hours from creation; use a new key to issue a new ticket. Package publication is coordinated separately from the workspace API.
531
+
532
+ ### GCP 网络凭据
533
+
534
+ 服务端开启 GCP 网络凭据类型后,使用现有 `vaults.credentials.create`:
535
+
536
+ ```ts
537
+ await client.vaults.credentials.create(vaultId, {
538
+ displayName: "Vertex Lyria",
539
+ auth: {
540
+ type: "net_secret",
541
+ envName: "BAND_LYRIA",
542
+ domains: ["us-central1-aiplatform.googleapis.com"],
543
+ gcp: { projectId, clientEmail, privateKey },
544
+ },
545
+ });
546
+ ```
547
+
548
+ `gcp` 与 `accessToken` 恰好提供一个;使用 GCP 时省略 `inject`。域名仅限 `aiplatform.googleapis.com`、区域前缀的 Vertex 主机或字面量 `*.aiplatform.googleapis.com`。OAuth scope 固定为 `cloud-platform`,服务账号应授予最小 Vertex 角色 `roles/aiplatform.user`。服务端只在本地校验私钥,不在创建时请求 Google。类型未启用时,写入返回 400 `vault_credential_gcp_not_enabled`;SDK 接受该输入不代表服务端已开启。
549
+
550
+ create、update、get、list 只返回 `scheme: "gcp_service_account"` 和 `gcp: { projectId, clientEmail }`,不返回 privateKey。静态凭据返回 `scheme: "static"`,SDK 也接受旧服务端缺少 scheme 的静态行。新建 envName 禁用 `_GCP_PROJECT_ID` 后缀;已有静态名称继续支持读取和原名轮换。通过 `vaults.credentials.update(vaultId, credentialId, { auth: { gcp } })` 整体替换服务账号,或用 `auth.accessToken` 切回静态凭据;id 不变,`rotationSeq` 递增。沙箱只收到占位符、gateway URL 和 `<NAME>_GCP_PROJECT_ID`;projectId 在下轮随当前服务账号更新,clientEmail 和 privateKey 不进入沙箱。运行时转发依赖服务端 gateway 的 GCP 支持。