@sleep2agi/commhub-server 0.9.0-preview.222 → 0.9.0-preview.224
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/commhub-server",
|
|
3
|
-
"version": "0.9.0-preview.
|
|
3
|
+
"version": "0.9.0-preview.224",
|
|
4
4
|
"description": "CommHub Server — AI Agent communication hub with MCP protocol, multi-network isolation, user auth, and MCP tools (17 collaboration-core + node/provider ops tools; authoritative list: docs-site/docs/api/mcp-tools.md).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -34,6 +34,7 @@ export const PUBLIC_HEALTH_KEY_READERS: Readonly<Record<string, AnonReaderEntry>
|
|
|
34
34
|
status: { reader: "cli", why: "客户端展示 Hub 的细分状态(ok / degraded)" },
|
|
35
35
|
status_reasons: { reader: "cli", why: "anet status 把 status_reasons 拼成一行原因给用户看(bin/cli.ts)" },
|
|
36
36
|
version: { reader: "cli", why: "版本不一致提示(anet 与 hub 的版本对齐)" },
|
|
37
|
+
version_source: { reader: "operator", why: "运维判断「版本没变」是没发出去还是被 env 覆盖;仓内无代码读" },
|
|
37
38
|
version_role: { reader: "external", why: "docs/release-hub-runbook.md 描述的仓外 dashboard 读它区分构建;仓内无消费者,未验" },
|
|
38
39
|
api_version: { reader: "cli", why: "客户端与 Hub 协商协议版本,不匹配时给出升级提示" },
|
|
39
40
|
transport: { reader: "cli", why: "协议协商(streamable-http)" },
|
|
@@ -1054,6 +1054,87 @@ describe("#473 anonymous /health — watchdog contract intact, no topology leak"
|
|
|
1054
1054
|
expect(Object.keys(authedProbe).length).toBeGreaterThan(Object.keys(anonProbe).length);
|
|
1055
1055
|
});
|
|
1056
1056
|
|
|
1057
|
+
// 2026-10-31 —— **未被读的字段 = 未验证的字段**(外部复核 ①:
|
|
1058
|
+
// 「not_applicable 占用了 hash 槽却活到今天,是因为那个字段从未被读取;
|
|
1059
|
+
// 字段『看起来有值』比『未被测的代码』更隐蔽」)。
|
|
1060
|
+
// 断言:HEALTH_FIELD_META 里每个键都必须至少被一条 server 测试提到;例外显式登记。
|
|
1061
|
+
// 上面那条 ratchet 抓出来的两个「被产出但没人读」字段,这里补上断言(而不是登记成例外)。
|
|
1062
|
+
test("alert_baselines and clk_tck_assumed_reason are actually read (not just produced)", async () => {
|
|
1063
|
+
const body = await (await fetch(`${BASE}/health`, { headers: { Authorization: `Bearer ${adminToken}` } })).json() as any;
|
|
1064
|
+
// alert_baselines:null(还没刷过)或 {at, rows, aliases} —— 两种形态都必须能说清
|
|
1065
|
+
expect(body).toHaveProperty("alert_baselines");
|
|
1066
|
+
if (body.alert_baselines !== null) {
|
|
1067
|
+
expect(typeof body.alert_baselines.at).toBe("string");
|
|
1068
|
+
expect(Number.isInteger(body.alert_baselines.rows)).toBe(true);
|
|
1069
|
+
expect(Number.isInteger(body.alert_baselines.aliases)).toBe(true);
|
|
1070
|
+
}
|
|
1071
|
+
// clk_tck_assumed_reason:一个必须能解释「为什么用假设值」的字符串(空串是合法的:读到了真实值)
|
|
1072
|
+
expect(typeof body.clk_tck_assumed_reason).toBe("string");
|
|
1073
|
+
// 它与 clk_tck_source 配对:source=assumed 时必须有理由,否则必须是空串
|
|
1074
|
+
if (body.clk_tck_source === "assumed") expect(body.clk_tck_assumed_reason.length).toBeGreaterThan(0);
|
|
1075
|
+
else expect(body.clk_tck_assumed_reason).toBe("");
|
|
1076
|
+
});
|
|
1077
|
+
|
|
1078
|
+
test("every /health field is read by at least one test (unread = unverified)", async () => {
|
|
1079
|
+
const { readFileSync, readdirSync, statSync } = await import("node:fs");
|
|
1080
|
+
const { join } = await import("node:path");
|
|
1081
|
+
const src = readFileSync(new URL("./server.ts", import.meta.url), "utf8");
|
|
1082
|
+
const start = src.indexOf("HEALTH_FIELD_META");
|
|
1083
|
+
const block = src.slice(start, src.indexOf("};", start));
|
|
1084
|
+
const keys = [...block.matchAll(/^ {2}([A-Za-z_][A-Za-z0-9_]*):\s*\{/gm)].map((m) => m[1]);
|
|
1085
|
+
expect(keys.length).toBeGreaterThan(30);
|
|
1086
|
+
const walk = (dir: string, out: string[] = []): string[] => {
|
|
1087
|
+
for (const name of readdirSync(dir)) {
|
|
1088
|
+
const full = join(dir, name);
|
|
1089
|
+
if (statSync(full).isDirectory()) walk(full, out);
|
|
1090
|
+
else if (name.endsWith(".test.ts")) out.push(full);
|
|
1091
|
+
}
|
|
1092
|
+
return out;
|
|
1093
|
+
};
|
|
1094
|
+
const testSource = walk(join(import.meta.dir)).map((f) => readFileSync(f, "utf8")).join("\n");
|
|
1095
|
+
const ALLOW_UNREAD: Record<string, string> = {};
|
|
1096
|
+
const unread = keys.filter((k) => !ALLOW_UNREAD[k] && !new RegExp(`\\b${k}\\b`).test(testSource));
|
|
1097
|
+
if (unread.length) {
|
|
1098
|
+
throw new Error(`这 ${unread.length} 个字段被产出但没有任何测试读它们:${unread.join(", ")}\n ⇒ 要么加断言,要么登记进 ALLOW_UNREAD 并写明为什么可以不读。`);
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
// 2026-10-31 —— **有覆盖、零仲裁**(外部复核 (d)):version 有两个来源
|
|
1103
|
+
// (standalone 二进制注入的 env / 磁盘 package.json),此前只报结果、不报谁赢了。
|
|
1104
|
+
// version_source 就是那个仲裁位;下面四例钉住它的语义。
|
|
1105
|
+
test("version_source names which override won (embedded_env / package_json / unknown)", async () => {
|
|
1106
|
+
const { resolveServerVersion } = await import("./server.js");
|
|
1107
|
+
expect(resolveServerVersion("0.9.0-preview.999", () => "0.9.0-preview.1"))
|
|
1108
|
+
.toEqual({ version: "0.9.0-preview.999", source: "embedded_env" });
|
|
1109
|
+
// env 形状不对 ⇒ 落到磁盘,而不是把非法值当版本号
|
|
1110
|
+
expect(resolveServerVersion("latest", () => "0.9.0-preview.1"))
|
|
1111
|
+
.toEqual({ version: "0.9.0-preview.1", source: "package_json" });
|
|
1112
|
+
// 磁盘读失败 ⇒ unknown,而不是伪装成某个来源
|
|
1113
|
+
expect(resolveServerVersion(undefined, () => { throw new Error("ENOENT"); }))
|
|
1114
|
+
.toEqual({ version: "?", source: "unknown" });
|
|
1115
|
+
expect(resolveServerVersion(" ", () => "?"))
|
|
1116
|
+
.toEqual({ version: "?", source: "unknown" });
|
|
1117
|
+
|
|
1118
|
+
// 线上读数与语义自洽:unknown ⇔ version 是 "?"
|
|
1119
|
+
const body = await (await fetch(`${BASE}/health`)).json() as any;
|
|
1120
|
+
expect(["embedded_env", "package_json", "unknown"]).toContain(body.version_source);
|
|
1121
|
+
if (body.version_source === "unknown") expect(body.version).toBe("?");
|
|
1122
|
+
else expect(body.version).not.toBe("?");
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
// 2026-10-31 —— **granularity=instant 的字段必须写出反事实**(外部复核 (c):
|
|
1126
|
+
// 「判法改为对『这个值变了,世界上什么变了』做反事实询问」)。
|
|
1127
|
+
// 这一类的共同陷阱:值在变,看起来有信息,而它变的可能只是**读的时刻**。
|
|
1128
|
+
test("every instant-granularity field states its counterfactual (why is mandatory)", async () => {
|
|
1129
|
+
const { HEALTH_FIELD_META } = await import("./server.js");
|
|
1130
|
+
const instant = Object.entries(HEALTH_FIELD_META).filter(([, m]: any) => m.granularity === "instant");
|
|
1131
|
+
expect(instant.length).toBeGreaterThanOrEqual(2);
|
|
1132
|
+
const missing = instant.filter(([, m]: any) => !(m.why && String(m.why).length > 8)).map(([k]) => k);
|
|
1133
|
+
if (missing.length) {
|
|
1134
|
+
throw new Error(`instant 字段没有写「变了意味着什么」:${missing.join(", ")}\n ⇒ 它可能只是读的时刻在变,而不是状态在变。`);
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1057
1138
|
test("no dead entries: every allow-listed key is actually served to anonymous callers", async () => {
|
|
1058
1139
|
const { PUBLIC_HEALTH_KEYS } = await import("./server.js");
|
|
1059
1140
|
const plain = await (await fetch(`${BASE}/health`)).json() as any;
|
|
@@ -263,4 +263,21 @@ describe("GET /api/providers", () => {
|
|
|
263
263
|
db.run(`DELETE FROM hub_provider_configs WHERE network_id = ?1 AND provider_id = 'hc-first'`, [ownerNet]);
|
|
264
264
|
});
|
|
265
265
|
|
|
266
|
+
|
|
267
|
+
// 2026-10-31 —— **写侧状态码是穷尽表**(外部复核:三元式默认分支 = 未映射与真实含义同值)。
|
|
268
|
+
// 两条断言分开:① 映射键 == 码清单;② 码清单里的每个码都真的在源码里被产出(跨源)。
|
|
269
|
+
test("provider write: every error code has a status, and every status code is really produced", async () => {
|
|
270
|
+
const { PROVIDER_WRITE_ERROR_CODES, PROVIDER_WRITE_STATUS } = await import("./hub-provider-config.js");
|
|
271
|
+
const { readFileSync } = await import("node:fs");
|
|
272
|
+
expect(Object.keys(PROVIDER_WRITE_STATUS).sort()).toEqual([...PROVIDER_WRITE_ERROR_CODES].sort());
|
|
273
|
+
for (const code of PROVIDER_WRITE_ERROR_CODES) {
|
|
274
|
+
expect(Number.isInteger(PROVIDER_WRITE_STATUS[code])).toBe(true);
|
|
275
|
+
expect(PROVIDER_WRITE_STATUS[code]).toBeGreaterThanOrEqual(400);
|
|
276
|
+
}
|
|
277
|
+
// 跨源:这些码必须能在源码里找到(`denied('x')` 或 vault 的 code 字面量),
|
|
278
|
+
// 否则清单会退化成「我们以为会发生的错误」。
|
|
279
|
+
const src = readFileSync(new URL("./hub-provider-config.ts", import.meta.url), "utf8");
|
|
280
|
+
const missing = [...PROVIDER_WRITE_ERROR_CODES].filter((c) => !src.includes(`'${c}'`) && !src.includes(`"${c}"`));
|
|
281
|
+
if (missing.length) throw new Error(`码清单里这些码在源码中找不到产出点:${missing.join(", ")}`);
|
|
282
|
+
});
|
|
266
283
|
});
|
|
@@ -7,6 +7,52 @@ import { requestProviderWrite } from './daemon-provider-snapshots';
|
|
|
7
7
|
type Human = { userId?: string | null; isNode: boolean; networkId: string | null };
|
|
8
8
|
type Config = { id: string; label: string; enabled: boolean; protocol: 'openai-responses' | 'openai-chat-completions' | 'anthropic-messages'; baseUrl: string; models: string[] };
|
|
9
9
|
const denied = (error: string) => ({ ok: false as const, error });
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 2026-10-31 —— **写侧错误的 HTTP 状态必须是穷尽表**(外部复核:三元式默认分支
|
|
13
|
+
* = 未映射与某个真实含义同值 ⇒ 口令字段;应改成 `Record<Code, number>`)。
|
|
14
|
+
*
|
|
15
|
+
* 原来 REST 路由里写的是:
|
|
16
|
+
* provider_owner_required ? 403 : revision_conflict ? 409 : access_denied ? 403 : 400
|
|
17
|
+
* ⇒ 新增一个错误码时它会**默认落到 400**,而 400 对某些码是错的(例如 vault 缺失应是 409/503)。
|
|
18
|
+
*
|
|
19
|
+
* 这里的码集合来自本文件里所有 `denied('...')` 与 VaultError 的 code;
|
|
20
|
+
* 测试会断言「映射键 == 码清单」,并且**码清单必须能在源码里逐个找到**(跨源,不是自说自话)。
|
|
21
|
+
*/
|
|
22
|
+
export const PROVIDER_WRITE_ERROR_CODES = [
|
|
23
|
+
"user_token_required",
|
|
24
|
+
"provider_owner_required",
|
|
25
|
+
"provider_access_denied",
|
|
26
|
+
"invalid_revision",
|
|
27
|
+
"invalid_hub_provider",
|
|
28
|
+
"invalid_provider_key",
|
|
29
|
+
"invalid_provider_secret_reference",
|
|
30
|
+
"provider_secret_reference_missing",
|
|
31
|
+
"provider_key_required",
|
|
32
|
+
"hub_provider_revision_conflict",
|
|
33
|
+
"hub_provider_disabled",
|
|
34
|
+
"hub_provider_save_failed",
|
|
35
|
+
"vault_unavailable",
|
|
36
|
+
] as const;
|
|
37
|
+
export type ProviderWriteErrorCode = (typeof PROVIDER_WRITE_ERROR_CODES)[number];
|
|
38
|
+
export const PROVIDER_WRITE_STATUS: Record<ProviderWriteErrorCode, number> = {
|
|
39
|
+
user_token_required: 401,
|
|
40
|
+
provider_owner_required: 403,
|
|
41
|
+
provider_access_denied: 403,
|
|
42
|
+
invalid_revision: 400,
|
|
43
|
+
invalid_hub_provider: 400,
|
|
44
|
+
invalid_provider_key: 400,
|
|
45
|
+
invalid_provider_secret_reference: 400,
|
|
46
|
+
provider_secret_reference_missing: 400,
|
|
47
|
+
provider_key_required: 400,
|
|
48
|
+
hub_provider_revision_conflict: 409,
|
|
49
|
+
hub_provider_disabled: 409,
|
|
50
|
+
hub_provider_save_failed: 500,
|
|
51
|
+
vault_unavailable: 503,
|
|
52
|
+
};
|
|
53
|
+
export function providerWriteStatus(code: string): number {
|
|
54
|
+
return (PROVIDER_WRITE_STATUS as Record<string, number>)[code] ?? 400;
|
|
55
|
+
}
|
|
10
56
|
const idValid = (id: unknown) => typeof id === 'string' && /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(id);
|
|
11
57
|
function auth(h: Human, write: boolean, owner = false) {
|
|
12
58
|
if (h.isNode || !h.userId || !h.networkId) return denied('user_token_required');
|
package/src/server.ts
CHANGED
|
@@ -106,7 +106,7 @@ import { listTaskLateReplies } from "./task-late-replies.js";
|
|
|
106
106
|
import { assertScheduledTaskBackendSupported, handleScheduledTaskRequest, startScheduledTaskScheduler } from "./scheduled-tasks.js";
|
|
107
107
|
import { startDueReminderTimer } from "./requirement-due-reminders.js";
|
|
108
108
|
import { handleRequirementsRequest } from "./requirements.js";
|
|
109
|
-
import { readHubProviders, putHubProvider } from "./hub-provider-config.js";
|
|
109
|
+
import { readHubProviders, putHubProvider, providerWriteStatus } from "./hub-provider-config.js";
|
|
110
110
|
import { requestNodeSecrets, getScopedSecrets } from "./scoped-secrets.js";
|
|
111
111
|
import { readEnvTransportLog } from "./env-transport-gate.js";
|
|
112
112
|
import { enforceImpactOf, normalizePeerAllowlist, normalizeToolAllowlist, restAllowlistVerdict, restRouteLabel } from "./node-permissions.js";
|
|
@@ -165,14 +165,39 @@ const MCP_LABEL_MAX_BYTES = 1024 * 1024;
|
|
|
165
165
|
// Read version from package.json so banners and /health stay in sync.
|
|
166
166
|
// ANET_EMBEDDED_COMMHUB_VERSION is set only by the standalone anet binary
|
|
167
167
|
// (bin/anet-bin.ts). npm/bunx leaves it unset and keeps the disk read.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
/**
|
|
169
|
+
* 2026-10-31 —— **有覆盖、零仲裁**(外部复核 (d):
|
|
170
|
+
* 「`versionSource`/`versionEnvIgnored` 在本仓库 0 命中 ⇒ `version` 是『有覆盖、零仲裁』的缺陷形态」)。
|
|
171
|
+
*
|
|
172
|
+
* 这个值有两个可能来源(standalone 二进制注入的 env / 磁盘 package.json),
|
|
173
|
+
* 而 `/health` 只报结果、不报**谁赢了**。后果:
|
|
174
|
+
* · 有人改了 package.json 却发现线上版本没变(被 env 覆盖)
|
|
175
|
+
* · 或以为在用二进制内嵌版本,其实是磁盘那个
|
|
176
|
+
* 两个方向都只能靠猜。⇒ 现在把来源作为字段一起给出。
|
|
177
|
+
*/
|
|
178
|
+
export type VersionSource = "embedded_env" | "package_json" | "unknown";
|
|
179
|
+
export function resolveServerVersion(
|
|
180
|
+
embeddedRaw: string | undefined,
|
|
181
|
+
readPackageVersion: () => string,
|
|
182
|
+
): { version: string; source: VersionSource } {
|
|
183
|
+
const embedded = (embeddedRaw ?? "").trim();
|
|
184
|
+
if (/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(embedded)) {
|
|
185
|
+
return { version: embedded, source: "embedded_env" };
|
|
186
|
+
}
|
|
171
187
|
try {
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
188
|
+
const v = readPackageVersion();
|
|
189
|
+
if (v && v !== "?") return { version: v, source: "package_json" };
|
|
190
|
+
return { version: "?", source: "unknown" };
|
|
191
|
+
} catch {
|
|
192
|
+
return { version: "?", source: "unknown" };
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const RESOLVED_VERSION = resolveServerVersion(process.env.ANET_EMBEDDED_COMMHUB_VERSION, () => {
|
|
196
|
+
const url = new URL("../package.json", import.meta.url);
|
|
197
|
+
return JSON.parse(require("fs").readFileSync(url, "utf8")).version || "?";
|
|
198
|
+
});
|
|
199
|
+
const SERVER_VERSION = RESOLVED_VERSION.version;
|
|
200
|
+
const SERVER_VERSION_SOURCE = RESOLVED_VERSION.source;
|
|
176
201
|
|
|
177
202
|
// Feature flags advertised on /health (see the /health handler). Exported for tests.
|
|
178
203
|
// node_permission_mode(#489):节点有 permission_mode、GET /api/nodes 每行带 viewer_can.permission_mode,
|
|
@@ -993,7 +1018,7 @@ function corsHeaders(req: Request): Record<string, string> {
|
|
|
993
1018
|
*/
|
|
994
1019
|
export const PUBLIC_HEALTH_KEYS: ReadonlySet<string> = new Set([
|
|
995
1020
|
// 存活/版本:外部 watchdog 与运维只靠这些判断「活没活」
|
|
996
|
-
"ok", "status", "status_reasons", "version", "version_role", "api_version", "transport", "uptime", "startedAt",
|
|
1021
|
+
"ok", "status", "status_reasons", "version", "version_source", "version_role", "api_version", "transport", "uptime", "startedAt",
|
|
997
1022
|
// 规模与健康度聚合(不含拓扑明细)
|
|
998
1023
|
"sessions_count", "sse_connections", "mcp_inflight", "mcp_inflight_peak",
|
|
999
1024
|
// 事件循环停顿是**一个对象**(event_loop: {max_gap_ms, recent_stalls,…}),
|
|
@@ -1134,6 +1159,11 @@ export const HEALTH_FIELD_META: Readonly<Record<string, HealthFieldMeta>> = {
|
|
|
1134
1159
|
why: "粗粒度版本号;精确字节身份由 git_commit 承担,而它不匿名",
|
|
1135
1160
|
identity_class: "declaration",
|
|
1136
1161
|
},
|
|
1162
|
+
version_source: {
|
|
1163
|
+
class: "gauge",
|
|
1164
|
+
granularity: "label",
|
|
1165
|
+
why: "同一字段的**仲裁位**:说明 version 是 env 注入(standalone 二进制)还是磁盘 package.json;不暴露路径或提交",
|
|
1166
|
+
},
|
|
1137
1167
|
version_role: {
|
|
1138
1168
|
class: "gauge",
|
|
1139
1169
|
granularity: "label",
|
|
@@ -1164,7 +1194,14 @@ export const HEALTH_FIELD_META: Readonly<Record<string, HealthFieldMeta>> = {
|
|
|
1164
1194
|
limits: { class: "gauge", granularity: "label" },
|
|
1165
1195
|
capabilities: { class: "gauge", granularity: "label" },
|
|
1166
1196
|
// ⚠️ 例外:**形似启动快照,但会变** —— 它的全部价值在于变,标成快照会毁掉它。
|
|
1167
|
-
served_at: {
|
|
1197
|
+
served_at: {
|
|
1198
|
+
class: "gauge",
|
|
1199
|
+
granularity: "instant",
|
|
1200
|
+
// 2026-10-31 —— granularity=instant 的字段必须写出**反事实**(外部复核 (c):
|
|
1201
|
+
// 「判法应改为对『这个值变了,世界上什么变了』做反事实询问」):
|
|
1202
|
+
// 它变的不是世界,是**这一次读取的时刻**;所以它只能当窗口端点,不能当「新鲜度」。
|
|
1203
|
+
why: "这一次读取的服务端时刻:变了不代表 Hub 状态变化,只代表又问了一次;用作窗口右端,不证明新鲜",
|
|
1204
|
+
},
|
|
1168
1205
|
build_identified: {
|
|
1169
1206
|
class: "gauge",
|
|
1170
1207
|
granularity: "verdict",
|
|
@@ -3534,6 +3571,7 @@ return Bun.serve({
|
|
|
3534
3571
|
status: statusReasons.length === 0 ? "ok" : "degraded",
|
|
3535
3572
|
status_reasons: statusReasons,
|
|
3536
3573
|
version: SERVER_VERSION,
|
|
3574
|
+
version_source: SERVER_VERSION_SOURCE,
|
|
3537
3575
|
// 2026-10-31 —— **version 是部署标签,不是代码指纹**(生产实例:4 分钟内 version 变、
|
|
3538
3576
|
// buildCommit 一字未变,同 commit 重新打包)。
|
|
3539
3577
|
// ⇒ 任何以 version 为键的巡检/回滚检测都会假跳或永远不跳。
|
|
@@ -4254,10 +4292,8 @@ return Bun.serve({
|
|
|
4254
4292
|
}
|
|
4255
4293
|
const saved = putHubProvider({ userId: restAuth.userId ?? null, isNode: false, networkId }, revision, body?.provider);
|
|
4256
4294
|
if (!saved.ok) {
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
: saved.error === "provider_access_denied" ? 403 : 400;
|
|
4260
|
-
return withCors(req, Response.json(saved, { status }));
|
|
4295
|
+
// 状态码来自穷尽表(hub-provider-config.ts: PROVIDER_WRITE_STATUS),不再在这里写三元式
|
|
4296
|
+
return withCors(req, Response.json(saved, { status: providerWriteStatus(saved.error) }));
|
|
4261
4297
|
}
|
|
4262
4298
|
return withCors(req, Response.json({ ...saved, network_id: networkId }));
|
|
4263
4299
|
}
|