cfpilot 0.13.1 → 0.13.2

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/cli.js CHANGED
@@ -87,7 +87,7 @@ var VERSION, NAME;
87
87
  var init_version = __esm({
88
88
  "src/shared/version.ts"() {
89
89
  "use strict";
90
- VERSION = "0.13.1";
90
+ VERSION = "0.13.2";
91
91
  NAME = "cfpilot";
92
92
  }
93
93
  });
@@ -2946,7 +2946,7 @@ ${NAME} deploy \u2014\u2014 \u53CC\u9762\u90E8\u7F72\uFF08\u63A7\u5236\u9762 Pag
2946
2946
  Worker \u7684\u300C\u57DF\u300D\u6807\u7B7E\u9875\u6DFB\u52A0\u3002**\u5DE5\u5177\u4E0D\u4F1A\u66FF\u4F60\u7ED1\u5B9A\u57DF\u540D**\u3002
2947
2947
  \u4E0D\u586B\u5219\u7528 *.workers.dev\uFF08\u591A\u6570\u7F51\u7EDC\u76F4\u8FDE\u4E0D\u53EF\u8BBF\u95EE\uFF0C\u8282\u70B9\u4F1A\u8FDE\u4E0D\u4E0A\uFF09
2948
2948
  --panel-path <path> \u9762\u677F\u8BBF\u95EE\u8DEF\u5F84\uFF08\u9ED8\u8BA4\u968F\u673A\uFF09
2949
- --mode <mode> \u90E8\u7F72\u6A21\u5F0F\uFF1Aauto\uFF08\u9ED8\u8BA4\uFF0C\u81EA\u52A8\u5224\u65AD\uFF09/ fresh\uFF08\u5F3A\u5236\u9996\u6B21\uFF09/ update\uFF08\u5F3A\u5236\u66F4\u65B0\uFF09
2949
+ --mode <mode> \u90E8\u7F72\u6A21\u5F0F\uFF1Aauto\uFF08\u9ED8\u8BA4\uFF0C\u81EA\u52A8\u5224\u65AD\uFF09/ fresh\uFF08\u5168\u65B0\u90E8\u7F72\uFF0C\u81EA\u52A8\u65B0\u5EFA KV\uFF09/ update\uFF08\u5F3A\u5236\u66F4\u65B0\uFF09
2950
2950
  --force \u5FFD\u7565\u7248\u672C\u68C0\u67E5\uFF0C\u5F3A\u5236\u91CD\u65B0\u90E8\u7F72
2951
2951
  --force-kv \u8DF3\u8FC7 KV \u5F52\u5C5E\u6821\u9A8C\uFF08\u660E\u77E5\u8BE5 KV \u5C5E\u4E8E\u522B\u7684\u5B9E\u4F8B\u4ECD\u7136\u7EE7\u7EED\uFF09
2952
2952
  --resolve-preferred=false
@@ -3152,7 +3152,19 @@ async function runDeployCommand(args) {
3152
3152
  await listKvInstances(client, resolvedAccount);
3153
3153
  return;
3154
3154
  }
3155
- const forceNewKv = flagBool(args, "new-kv");
3155
+ const mode = flagString(args, "mode") || "auto";
3156
+ if (!["auto", "fresh", "update"].includes(mode)) {
3157
+ process.stderr.write(`\u2717 --mode \u53EA\u63A5\u53D7 auto / fresh / update\uFF0C\u6536\u5230\uFF1A${mode}
3158
+ `);
3159
+ process.exitCode = 1;
3160
+ return;
3161
+ }
3162
+ if (mode === "fresh" && kvId) {
3163
+ process.stdout.write(`\xB7 \u5168\u65B0\u90E8\u7F72\u4F1A\u65B0\u5EFA\u72EC\u7ACB KV\uFF0C\u5DF2\u5FFD\u7565 --kv ${kvId}
3164
+ `);
3165
+ kvId = "";
3166
+ }
3167
+ const forceNewKv = flagBool(args, "new-kv") || mode === "fresh";
3156
3168
  const existing = await listCfPilotNamespaces(client, resolvedAccount);
3157
3169
  if (!kvId && !forceNewKv) {
3158
3170
  if (existing.length === 0) {
@@ -3186,8 +3198,10 @@ async function runDeployCommand(args) {
3186
3198
  }
3187
3199
  } else if (!kvId && forceNewKv) {
3188
3200
  const title = flagString(args, "kv-title") || `cfpilot-kv-${Date.now().toString(36)}`;
3189
- process.stdout.write(`\u521B\u5EFA\u65B0\u7684 KV \u547D\u540D\u7A7A\u95F4\uFF08--new-kv\uFF09\uFF1A${title}
3190
- `);
3201
+ process.stdout.write(
3202
+ `\u521B\u5EFA\u65B0\u7684 KV \u547D\u540D\u7A7A\u95F4\uFF08${mode === "fresh" ? "\u5168\u65B0\u90E8\u7F72" : "--new-kv"}\uFF09\uFF1A${title}
3203
+ `
3204
+ );
3191
3205
  const ns = await client.createKvNamespace(resolvedAccount, title);
3192
3206
  kvId = ns.id;
3193
3207
  process.stdout.write(`\u2713 KV \u5DF2\u521B\u5EFA\uFF1A${ns.id}
@@ -3197,13 +3211,6 @@ async function runDeployCommand(args) {
3197
3211
  `);
3198
3212
  }
3199
3213
  }
3200
- const mode = flagString(args, "mode") || "auto";
3201
- if (!["auto", "fresh", "update"].includes(mode)) {
3202
- process.stderr.write(`\u2717 --mode \u53EA\u63A5\u53D7 auto / fresh / update\uFF0C\u6536\u5230\uFF1A${mode}
3203
- `);
3204
- process.exitCode = 1;
3205
- return;
3206
- }
3207
3214
  const dataPlaneRaw = (flagString(args, "data-plane") || "").toLowerCase();
3208
3215
  if (dataPlaneRaw && dataPlaneRaw !== "pages" && dataPlaneRaw !== "workers") {
3209
3216
  process.stderr.write(`\u2717 --data-plane \u53EA\u63A5\u53D7 pages / workers\uFF0C\u6536\u5230\uFF1A${dataPlaneRaw}
@@ -4031,7 +4038,7 @@ function measureThroughput(options) {
4031
4038
  requiredHeader,
4032
4039
  minBytes = 32 * 1024
4033
4040
  } = options;
4034
- const connCount = Math.max(1, Math.min(8, connections));
4041
+ const connCount = Math.max(1, Math.min(16, connections));
4035
4042
  return new Promise((resolve3) => {
4036
4043
  const started = Date.now();
4037
4044
  let settled = false;
@@ -4320,16 +4327,32 @@ var init_true_probe = __esm({
4320
4327
  this.windowStart = now;
4321
4328
  return this.peak;
4322
4329
  }
4323
- /** 结算一个窗口:慢启动期内只丢弃,不记峰值/稳态 */
4330
+ /**
4331
+ * 结算一个窗口:慢启动期内只丢弃,不记峰值/稳态。
4332
+ *
4333
+ * 两处口径细节(都会让稳态**偏低**,方向单一,必须排除):
4334
+ *
4335
+ * 1. **空窗不计时**:链路中途停顿(个别连接已结束、其余在等数据)时,
4336
+ * 把停顿时间算进分母等于把「没有测到」当成「测到很慢」。
4337
+ * 2. **跨界窗口只折算边界之后的部分**:预热结束前后各占一半的窗口若整窗计入,
4338
+ * 预热期的慢速样本会以整窗权重拉低稳态(反之也可能抬高)。
4339
+ */
4324
4340
  settle(now) {
4325
4341
  const dt = (now - this.windowStart) / 1e3;
4326
4342
  if (dt <= 0) return;
4327
4343
  const bytes = this.windowBytes;
4344
+ const windowStart = this.windowStart;
4328
4345
  this.windowBytes = 0;
4329
4346
  this.windowStart = now;
4330
- if (now - this.startedAt < this.warmupMs) return;
4331
- this.steadyBytes += bytes;
4332
- this.steadySeconds += dt;
4347
+ if (bytes === 0) return;
4348
+ const warmupEnd = this.startedAt + this.warmupMs;
4349
+ const effectiveStart = Math.max(windowStart, warmupEnd);
4350
+ const effectiveSeconds = (now - effectiveStart) / 1e3;
4351
+ if (effectiveSeconds <= 0) return;
4352
+ const share = effectiveSeconds / dt;
4353
+ const effectiveBytes = bytes * share;
4354
+ this.steadyBytes += effectiveBytes;
4355
+ this.steadySeconds += effectiveSeconds;
4333
4356
  const speed = bytes / dt / 1024 / 1024;
4334
4357
  if (speed > this.peak) this.peak = speed;
4335
4358
  }
@@ -6113,7 +6136,7 @@ scan \u9009\u9879:
6113
6136
  url = \u53EA\u7528\u516C\u5F00\u6D4B\u901F\u5730\u5740\uFF08\u4EFB\u4F55\u9879\u76EE\u90FD\u80FD\u6D4B\uFF09
6114
6137
  --speed-url <url> \u516C\u5F00\u6D4B\u901F\u5730\u5740\uFF0C\u9ED8\u8BA4 ${DEFAULT_SPEED_URL}
6115
6138
  \u53EF\u6362\u6210\u4EFB\u610F\u8FD4\u56DE\u5927\u6587\u4EF6\u7684\u5730\u5740
6116
- --speed-conns <n> \u6D4B\u901F\u5E76\u53D1\u8FDE\u63A5\u6570\uFF0C\u9ED8\u8BA4 8
6139
+ --speed-conns <n> \u6D4B\u901F\u5E76\u53D1\u8FDE\u63A5\u6570\uFF0C\u9ED8\u8BA4 8\uFF0C\u6700\u5927 16
6117
6140
  \u8DE8\u5883\u94FE\u8DEF\u5355\u6761 TCP \u53D7\u4E22\u5305 / \u62E5\u585E\u7A97\u53E3\u9650\u5236\u3002\u5B9E\u6D4B\u540C\u4E00\u4E2A IP\uFF1A
6118
6141
  1 \u6761 0.12 MB/s\u30013 \u6761 0.47\u30018 \u6761 1.15\u300116 \u6761 2.22 \u2014\u2014
6119
6142
  \u7528 1~3 \u6761\u4F1A\u7CFB\u7EDF\u6027\u4F4E\u4F30 2~4 \u500D\uFF1B8 \u6761\u66F4\u8D34\u8FD1\u6D4F\u89C8\u5668\u771F\u5B9E\u884C\u4E3A
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfpilot",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "CFPilot —— Cloudflare Pages 代理部署与优选工具(交互菜单 + 子命令)",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",