coopani-world-journey 2.3.0 → 2.3.1

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
@@ -1,5 +1,15 @@
1
1
  # 更新日志
2
2
 
3
+ ## 2.3.1 — 2026-11-21(修复 2.1–2.3.0 五组逻辑与边界缺口 + 跨洲机票校准)
4
+
5
+ - **跨洲机票校准 + 整趟算钱按真实可用方式算**:3000km 以上跨国机票按 `2550 + (km - 3000) * 0.56` 计算(11000km ≈ 7030 元,对齐实际报价);`cheapestFare` / `canAffordTrip` / `pledgeAffordable` 传入起终点后按 `usableModesFor` 过滤可用方式,跨海 / 跨洲 / 大陆 ↔ 台湾不再拿 0.21 元/公里的火车价低估票钱;`inviteSomeone` 补齐第二段连通性检查。
6
+ - **参考图与提示词四处防呆**:提前解析出图后端;仅当后端认参考图且真带了人物/服饰/非 `*` 手填图(`hasPersonRef`)时才清空文字 `cast` 并设 `castFromRef`,非方舟后端或仅带 `*` 画风图/场景图不再丢人物描述;后端拒收参考图降级时不再写入 `photos.json`;`castFromRef` 不再在未填 `imageStyle` 时被硬塞写实胶片底色。
7
+ - **同城探针时钟/时区与换城脏数**:`refreshMeetIfDown` 与 `probeNearby` 统一改用目的地当地小时和世界日期(`localMoment(now, city.tz)`),消除倍速与跨时区下的错位;`uiSnapshot().social` 读取 `nearbyProbe` 时先校验 `cityId === hereId`,换城未刷新探针前不再漏出旧城数字。
8
+ - **接约回执与竞态**:`reopenTodayDecision` 拆出 `'here'`(已在目的地或已在会合城等人)并把八点后未判归入 `'reopened'`,消除「已在会合城等人却说这就赶车」与「大白天说太晚/在睡」的自相矛盾;`takeInvite` 返程竞态补上 `isError: true`。
9
+ - **细节补齐**:月报海报水印检查补传 `arkBackend`;手填 `imageRefs` 支持重拍按文件名找回;相册放大层关闭时追加 `removeAttribute('src')`。
10
+
11
+ 测试:新增 6 条回归断言,全量 `test/*.test.mjs` **1195/1195**、`ui-smoke` **25/25**、`clock-sync` **8/8**、`home-e2e` **37/37**、`home-reason` **8/8**、`photo-e2e` **38/38** 通过。
12
+
3
13
  ## 2.3.0 — 2026-11-21(钱不够就别接约:算的是整趟,不是一张票)
4
14
 
5
15
  Mr.Q:「钱不够最好让她不要接邀约比较好(花销开关打开的情况下)」。
package/dist/webui.js CHANGED
@@ -1463,6 +1463,7 @@ export default {
1463
1463
  const lbClose = () => {
1464
1464
  lb.hidden = true;
1465
1465
  lbImg.src = '';
1466
+ lbImg.removeAttribute?.('src');
1466
1467
  lbList = [];
1467
1468
  };
1468
1469
  lbX.addEventListener('click', lbClose, { signal: ctx.signal });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coopani-world-journey",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "type": "module",
5
5
  "description": "大肥鱼环游世界 · 让桌宠真的出门去旅行:走遍 193 座城市,路上耗着真实时间、按当地作息吃饭看日出、写旅行日记,还能在城里偶遇别人的宠物、月底生成一份手账。(需 Coopani 0.2.17+)",
6
6
  "author": {
package/src/photo.ts CHANGED
@@ -2429,7 +2429,7 @@ export function photoPrompt(scene: PhotoScene): string {
2429
2429
  * 「一张真实旅行照片:」+「胶片质感,自然光」把 `anime style` 压过去了。
2430
2430
  * 风格是跟着人物走的,人物说了算,不该再被这几句拽回来。
2431
2431
  */
2432
- const realism = !cast && !custom && !bare;
2432
+ const realism = !cast && !scene.castFromRef && !custom && !bare;
2433
2433
  const lead = bare ? '' : custom ? `${raw}:` : realism ? '一张真实旅行照片:' : '';
2434
2434
 
2435
2435
  /*
@@ -653,6 +653,13 @@ export const photoMethods: Record<string, any> = {
653
653
  */
654
654
  const castOn = !!this.cfg.imageCast
655
655
  && seededRandom(`${dateKey}:${sceneId}:cast`)() <= this.cfg.imageCastChance;
656
+ const backend = resolveImageBackend(this.cfg);
657
+ if (backend.sizeNote && !this.imageSizeNoted) {
658
+ this.imageSizeNoted = true;
659
+ this.log?.info(backend.sizeNote);
660
+ }
661
+ const canSendRefs = backend.protocol !== 'comfyui' && this.refsAllowedBackend(backend);
662
+
656
663
  /*
657
664
  * 参考图(2026-11-20)。**默认关**,开了才读图鉴与手填路径。
658
665
  *
@@ -661,11 +668,15 @@ export const photoMethods: Record<string, any> = {
661
668
  * 并在日志里说一句,免得他以为"重拍还是原来那张脸"。
662
669
  */
663
670
  const refPick = (() => {
664
- if (!this.cfg.imageUseRefs) return { paths: [] as string[], labels: [] as string[], dropped: [] as string[] };
671
+ if (!this.cfg.imageUseRefs) {
672
+ return { paths: [] as string[], labels: [] as string[], dropped: [] as string[], hasPersonRef: false };
673
+ }
665
674
  const remembered = override?.refs ?? [];
666
675
  if (remembered.length) {
667
676
  const found = this.findLibraryRefsByName(remembered);
668
- if (found.length) return { paths: found, labels: remembered, dropped: [] as string[] };
677
+ if (found.paths.length) {
678
+ return { paths: found.paths, labels: remembered, dropped: [] as string[], hasPersonRef: found.hasPersonRef };
679
+ }
669
680
  this.log?.info(`重拍沿用的参考图已不在图鉴里(${remembered.join('、')}),改按当前配置重新取。`);
670
681
  }
671
682
  return this.collectRefPaths(subject, castOn, spot, String(this.cfg.imageCast ?? ''), this.photoDoingNow(city, hour));
@@ -676,6 +687,13 @@ export const photoMethods: Record<string, any> = {
676
687
  this.log?.warn(`参考图跳过 ${gone.length} 张(读不到或太大,单张上限 4MB):${gone.slice(0, 3).join('、')}`);
677
688
  }
678
689
  const refsOn = refPack.urls.length > 0;
690
+ /*
691
+ * 只有「后端真的收参考图」且「这批参考图里真有人物/服饰/手填人物图」时,
692
+ * 才把文字 `cast` 交给参考图接管。
693
+ * - 非方舟后端不发 `image` 字段,抹掉 `cast` 会导致画面彻底丢掉人物描述;
694
+ * - 只有场景参考图或 `*` 画风图时抹掉 `cast`,会让模型拿风景照当人脸。
695
+ */
696
+ const personRefActive = refsOn && canSendRefs && refPick.hasPersonRef;
679
697
  /*
680
698
  * 有人那几张可以用另一套风格(`imageStyleCast`)。留空就还是 `imageStyle`。
681
699
  * 这样「风景写实 + 自拍二次元」才成立 —— 风格和有没有人本来就是两件事。
@@ -714,8 +732,8 @@ export const photoMethods: Record<string, any> = {
714
732
  * 有参考图时**不写人物描述**:两套外观同时给,模型会各听一半。
715
733
  * 外观交给图,提示词只留「画面里只有这一个人」这条存在性约束。
716
734
  */
717
- cast: castOn && !refsOn ? this.cfg.imageCast : '',
718
- ...(castOn && refsOn ? { castFromRef: true } : {}),
735
+ cast: castOn && !personRefActive ? this.cfg.imageCast : '',
736
+ ...(castOn && personRefActive ? { castFromRef: true } : {}),
719
737
  // 抬头还是看脚下。天空照仍受当地时刻和天气约束。
720
738
  view,
721
739
  /* 她自己写的那一句(2026-11-10)。空 = 不出现,老行为不变。 */
@@ -821,11 +839,6 @@ export const photoMethods: Record<string, any> = {
821
839
  *
822
840
  * `sizeNote` 只在第一次说一遍:它每次都成立,刷屏没有信息量。
823
841
  */
824
- const backend = resolveImageBackend(this.cfg);
825
- if (backend.sizeNote && !this.imageSizeNoted) {
826
- this.imageSizeNoted = true;
827
- this.log?.info(backend.sizeNote);
828
- }
829
842
  const shot = backend.protocol === 'comfyui'
830
843
  ? await shootComfy({
831
844
  api: backend.api,
@@ -883,9 +896,9 @@ export const photoMethods: Record<string, any> = {
883
896
  ...(this.cfg.imageTimeoutSec > 0 ? { timeoutMs: this.cfg.imageTimeoutSec * 1000 } : {}),
884
897
  ...(signal ? { signal } : {}),
885
898
  size: backend.size,
886
- ...(refsOn && this.refsAllowedBackend(backend) ? { refs: refPack.urls } : {}),
899
+ ...(refsOn && canSendRefs ? { refs: refPack.urls } : {}),
887
900
  });
888
- if (refsOn && !this.refsAllowedBackend(backend)) {
901
+ if (refsOn && !canSendRefs) {
889
902
  this.log?.warn(
890
903
  `配了 ${refPack.urls.length} 张参考图,但当前服务端(${backend.model || backend.api})不认 image 字段,`
891
904
  + '这一张按纯文生图发;要用参考图请换成火山方舟的 seedream 系模型。',
@@ -1010,7 +1023,7 @@ export const photoMethods: Record<string, any> = {
1010
1023
  */
1011
1024
  const rec: PhotoRecord = {
1012
1025
  handle,
1013
- ...(refPack.names.length ? { refs: refPack.names } : {}),
1026
+ ...(refsOn && canSendRefs && !shot.refsDropped && refPack.names.length ? { refs: refPack.names } : {}),
1014
1027
  cityId: sceneId,
1015
1028
  cityName: onRoad ? '路上' : city.name,
1016
1029
  dateKey,
@@ -1326,7 +1339,7 @@ export const photoMethods: Record<string, any> = {
1326
1339
  ...(this.cfg.imageTimeoutSec > 0 ? { timeoutMs: this.cfg.imageTimeoutSec * 1000 } : {}),
1327
1340
  size: posterBackend.size,
1328
1341
  });
1329
- const bytes = shouldCropWatermark(this.cfg.imageWatermark, this.cfg.imageProtocol)
1342
+ const bytes = shouldCropWatermark(this.cfg.imageWatermark, this.cfg.imageProtocol, this.arkBackend(posterBackend))
1330
1343
  && shot.mime === 'image/png'
1331
1344
  ? cropBottom(shot.bytes, WATERMARK_CROP_RATIO)
1332
1345
  : shot.bytes;
@@ -1497,14 +1510,16 @@ export const photoMethods: Record<string, any> = {
1497
1510
  spot: string,
1498
1511
  castHint: string,
1499
1512
  doing: string,
1500
- ): { paths: string[]; labels: string[]; dropped: string[] } {
1501
- const out: { paths: string[]; labels: string[]; dropped: string[] } = { paths: [], labels: [], dropped: [] };
1513
+ ): { paths: string[]; labels: string[]; dropped: string[]; hasPersonRef: boolean } {
1514
+ const out: { paths: string[]; labels: string[]; dropped: string[]; hasPersonRef: boolean } = {
1515
+ paths: [], labels: [], dropped: [], hasPersonRef: false,
1516
+ };
1502
1517
  if (!this.cfg.imageUseRefs) return out;
1503
1518
  // 抬头拍天:带人物参考图只会让模型往天上塞人。
1504
1519
  if (subject === 'sky') return out;
1505
1520
 
1506
- const addEntry = (root: string, cat: string, entry: LibEntry | null, max: number): void => {
1507
- if (!entry) return;
1521
+ const addEntry = (root: string, cat: string, entry: LibEntry | null, max: number): number => {
1522
+ if (!entry) return 0;
1508
1523
  let n = 0;
1509
1524
  for (const img of entry.images) {
1510
1525
  if (n >= max) break;
@@ -1515,18 +1530,20 @@ export const photoMethods: Record<string, any> = {
1515
1530
  out.labels.push(img);
1516
1531
  n += 1;
1517
1532
  }
1533
+ return n;
1518
1534
  };
1519
1535
 
1520
1536
  try {
1521
1537
  const pack = this.libraryPack();
1522
1538
  if (pack) {
1523
1539
  // 人物最多两张:第一张定脸,第二张补侧面/全身;再多只是把请求体撑大。
1524
- addEntry(pack.root, 'characters', castOn ? matchLibraryEntry(
1540
+ const charAdded = addEntry(pack.root, 'characters', castOn ? matchLibraryEntry(
1525
1541
  loadLibraryCategory(pack.root, 'characters'), [castHint, this.opts.botName ?? ''], true,
1526
1542
  ) : null, 2);
1527
- addEntry(pack.root, 'outfits', castOn ? matchLibraryEntry(
1543
+ const outfitAdded = addEntry(pack.root, 'outfits', castOn ? matchLibraryEntry(
1528
1544
  loadLibraryCategory(pack.root, 'outfits'), [pack.outfitHint, doing, castHint], false,
1529
1545
  ) : null, 1);
1546
+ if (charAdded > 0 || outfitAdded > 0) out.hasPersonRef = true;
1530
1547
  addEntry(pack.root, 'scenes', matchLibraryEntry(
1531
1548
  loadLibraryCategory(pack.root, 'scenes'), [spot], false,
1532
1549
  ), 1);
@@ -1560,6 +1577,7 @@ export const photoMethods: Record<string, any> = {
1560
1577
  if (out.paths.includes(fp)) continue;
1561
1578
  out.paths.push(fp);
1562
1579
  out.labels.push(fp);
1580
+ if (!always) out.hasPersonRef = true;
1563
1581
  }
1564
1582
  return out;
1565
1583
  },
@@ -1622,24 +1640,47 @@ export const photoMethods: Record<string, any> = {
1622
1640
  return /volces\.com|ark\.cn-beijing/.test(host) || /doubao-seedream/.test(model);
1623
1641
  },
1624
1642
 
1625
- /** 按文件名在库内找回参考图(重拍沿用旧名单用)。找不到就返回空,交给调用方回退。 */
1626
- findLibraryRefsByName(names: readonly string[]): string[] {
1627
- if (!names.length) return [];
1628
- const pack = this.libraryPack();
1629
- if (!pack) return [];
1643
+ /** 按文件名在库内及手填路径里找回参考图(重拍沿用旧名单用)。找不到就返回空,交给调用方回退。 */
1644
+ findLibraryRefsByName(names: readonly string[]): { paths: string[]; hasPersonRef: boolean } {
1645
+ if (!names.length) return { paths: [], hasPersonRef: false };
1630
1646
  const out: string[] = [];
1631
- for (const cat of ['characters', 'outfits', 'scenes', 'props']) {
1632
- const dir = join(pack.root, cat);
1633
- if (!existsSync(dir)) continue;
1634
- for (const sub of readdirSync(dir).sort()) {
1635
- for (const nm of names) {
1636
- if (!nm || nm.includes('/') || nm.includes('\\')) continue;
1637
- const fp = join(dir, sub, nm);
1638
- if (existsSync(fp) && !out.includes(fp)) out.push(fp);
1647
+ let hasPersonRef = false;
1648
+ const pack = this.libraryPack();
1649
+ if (pack) {
1650
+ for (const cat of ['characters', 'outfits', 'scenes', 'props']) {
1651
+ const dir = join(pack.root, cat);
1652
+ if (!existsSync(dir)) continue;
1653
+ for (const sub of readdirSync(dir).sort()) {
1654
+ for (const nm of names) {
1655
+ if (!nm || nm.includes('/') || nm.includes('\\')) continue;
1656
+ const fp = join(dir, sub, nm);
1657
+ if (existsSync(fp) && !out.includes(fp)) {
1658
+ out.push(fp);
1659
+ if (cat === 'characters' || cat === 'outfits') hasPersonRef = true;
1660
+ }
1661
+ }
1639
1662
  }
1640
1663
  }
1641
1664
  }
1642
- return out;
1665
+ // 兜底匹配手填参考图里的文件名,避免非图鉴用户重拍时每次都回退重建。
1666
+ const manualLines = String(this.cfg.imageRefs ?? '').split(/\r?\n/);
1667
+ for (const nm of names) {
1668
+ if (!nm || nm.includes('/') || nm.includes('\\')) continue;
1669
+ for (const line of manualLines) {
1670
+ const marked = line.trim();
1671
+ if (!marked) continue;
1672
+ const always = marked.startsWith('*');
1673
+ const raw = always ? marked.slice(1).trim() : marked;
1674
+ if (!raw) continue;
1675
+ const fp = raw.startsWith('/') || /^[a-zA-Z]:[\\/]/.test(raw) ? raw : resolve(this.opts.dataDir, raw);
1676
+ const base = fp.split(/[\\/]/).pop();
1677
+ if (base === nm && existsSync(fp) && !out.includes(fp)) {
1678
+ out.push(fp);
1679
+ if (!always) hasPersonRef = true;
1680
+ }
1681
+ }
1682
+ }
1683
+ return { paths: out, hasPersonRef };
1643
1684
  },
1644
1685
 
1645
1686
  photoDoingNow(city: { id: string; tz: string }, hour: number): string {
@@ -426,10 +426,14 @@ export const purseMethods: Record<string, any> = {
426
426
  *
427
427
  * 2026-11-03 模拟抓到的:不分国内国际的话,兰州飞大阪 2600 公里只要 1040 块,
428
428
  * 比现实便宜一半 —— 她于是动不动就飞出去,预算 3000 的人 48 天花掉四万七。
429
+ *
430
+ * 2026-11-21 Mr.Q 实查跨洲机票约 7000 元(兰州 → 纽约 ~11000km):
431
+ * 3000km 处接上 3000 × 0.85 = 2550,往后按 0.56 元/公里递加(11000km ≈ 7030 元)。
429
432
  */
430
433
  const per = crossBorder ? 0.85 : 0.4;
431
- const base = crossBorder ? 2400 : 1200;
432
- return (km <= 3000 ? km * per : base + (km - 3000) * 0.9) * seatMult;
434
+ const base = crossBorder ? 2550 : 1200;
435
+ const tailPer = crossBorder ? 0.56 : 0.9;
436
+ return (km <= 3000 ? km * per : base + (km - 3000) * tailPer) * seatMult;
433
437
  }
434
438
  /*
435
439
  * 铁路分段算(2026-11-08):短途高铁、长途卧铺,单价差一倍。
@@ -569,18 +573,24 @@ export const purseMethods: Record<string, any> = {
569
573
  * 门槛是余钱的八成:留两成,到家之后还要过日子。
570
574
  * 没记账、预算填 0 时一律算回得去。
571
575
  */
572
- canAffordTrip(km: number, crossBorder = false): boolean {
576
+ canAffordTrip(km: number, crossBorder = false, pair?: { from: City; to: City }): boolean {
573
577
  const left = this.purseLeft();
574
578
  if (left === null) return true;
575
579
  if (left <= 0) return false;
576
- const cheapest = this.cheapestFare(km, crossBorder);
580
+ const cheapest = this.cheapestFare(km, crossBorder, pair);
577
581
  return cheapest <= left * 0.8;
578
582
  },
579
583
 
580
- /** 这一对上最便宜那张票(不问方式,只问价 —— 别问「她会不会挑最便宜的」,那是另一件事)。 */
581
- cheapestFare(km: number, crossBorder = false): number {
582
- return Math.min(...(['bus', 'train', 'plane', 'ship', 'car'] as const)
583
- .map((id) => this.fareOf(id, km, crossBorder)));
584
+ /**
585
+ * 这一对上最便宜那张票。
586
+ *
587
+ * 给了 `from / to` 时,只算这对城市间**真能走的方式**(`usableModesFor`):
588
+ * 跨海 / 跨洲 / 大陆 ↔ 台湾不能坐火车,不算不存在的 0.21 元/公里地面票。
589
+ */
590
+ cheapestFare(km: number, crossBorder = false, pair?: { from: City; to: City }): number {
591
+ const usable = pair ? usableModesFor(pair.from, pair.to, km).map((m) => m.id) : [];
592
+ const ids = usable.length ? usable : (['bus', 'train', 'plane', 'ship', 'car'] as const);
593
+ return Math.min(...ids.map((id) => this.fareOf(id, km, crossBorder)));
584
594
  },
585
595
 
586
596
 
@@ -608,7 +618,7 @@ export const purseMethods: Record<string, any> = {
608
618
  * 回执要把四笔数都摆出来,否则她只能笼统说「钱不够」,用户没法判断是不是自己预算填错了。
609
619
  */
610
620
  pledgeAffordable(
611
- legs: readonly { readonly km: number; readonly crossBorder?: boolean }[],
621
+ legs: readonly { readonly km: number; readonly crossBorder?: boolean; readonly from?: City; readonly to?: City }[],
612
622
  days: number,
613
623
  to: City,
614
624
  ): {
@@ -622,7 +632,10 @@ export const purseMethods: Record<string, any> = {
622
632
  * **票钱取整**。`fareOf` 是 0.33 元/公里那种算式,直接拼进回执会变成
623
633
  * 「票 204.60000000000002」—— 浮点尾巴进了给人看的句子,一眼就是机器写的。
624
634
  */
625
- const fare = Math.round(legs.reduce((sum, l) => sum + this.cheapestFare(l.km, l.crossBorder === true), 0));
635
+ const fare = Math.round(legs.reduce((sum, l) => {
636
+ const pair = l.from && l.to ? { from: l.from, to: l.to } : undefined;
637
+ return sum + this.cheapestFare(l.km, l.crossBorder === true, pair);
638
+ }, 0));
626
639
  const need = fare + (bed + MEALS_PER_DAY) * n;
627
640
  return { ok: left === null || need <= left, need, left, fare, bed, meals: MEALS_PER_DAY, days: n };
628
641
  },
@@ -562,7 +562,7 @@ export const socialMethods: Record<string, any> = {
562
562
  this.meetRetryStep = Math.min(this.meetRetryStep + 1, 8);
563
563
  const here = this.cityOrNull(this.st.hereId);
564
564
  if (!here) return;
565
- const slot = slotOf(now.getHours());
565
+ const slot = slotOf(localMoment(now, here.tz).hour);
566
566
  const b = await findNeighbors(meet, here.id, slot).catch(() => null);
567
567
  if (!b?.ok) return;
568
568
  /*
@@ -572,7 +572,7 @@ export const socialMethods: Record<string, any> = {
572
572
  * (失败也占住那一小时),面板上的「今天来过几只」还要再等近一小时 ——
573
573
  * 灯绿了、数字还是错的,等于只修了一半。
574
574
  */
575
- this.noteNeighbors(here.id, localMoment(this.realNow(), here.tz).dateKey, b, real);
575
+ this.noteNeighbors(here.id, localMoment(now, here.tz).dateKey, b, real);
576
576
  },
577
577
 
578
578
 
@@ -635,7 +635,8 @@ export const socialMethods: Record<string, any> = {
635
635
  if (!city) return;
636
636
  const realDate = this.realNow();
637
637
  const real = realDate.getTime();
638
- const day = localMoment(realDate, city.tz).dateKey;
638
+ const moment = localMoment(now, city.tz);
639
+ const day = moment.dateKey;
639
640
  const same = this.nearbyProbe?.cityId === city.id && this.nearbyProbe?.day === day;
640
641
  if (same && real - (this.nearbyProbe?.at ?? 0) < STATUS_PROBE_MS) return;
641
642
  /*
@@ -647,7 +648,7 @@ export const socialMethods: Record<string, any> = {
647
648
  here: same ? (this.nearbyProbe?.here ?? 0) : 0,
648
649
  n: same ? (this.nearbyProbe?.n ?? 0) : 0,
649
650
  };
650
- const b = await findNeighbors(meet, city.id, slotOf(now.getHours())).catch(() => null);
651
+ const b = await findNeighbors(meet, city.id, slotOf(moment.hour)).catch(() => null);
651
652
  if (!b?.ok) {
652
653
  /*
653
654
  * 断线要亮灯,并且占住退避位(2026-11-20 回补)。
@@ -885,6 +886,13 @@ export const socialMethods: Record<string, any> = {
885
886
  }
886
887
  /* 见面城和目的地相同时没有「见面」这一级,按老口径发。 */
887
888
  if (meetCity && meetCity.id === c.id) meetCity = null;
889
+ const fromStop = meetCity ?? here;
890
+ if (!canTravel(fromStop, c)) {
891
+ return {
892
+ text: `${meetCity ? `从见面的${meetCity.name}` : `从${here.name}这儿`}没路去${c.name}(隔着海,或者那边没有机场)—— 先别约人,约了也走不成。`,
893
+ isError: true,
894
+ };
895
+ }
888
896
 
889
897
  const d = Math.min(14, Math.max(1, Math.round(Number(days) || 2)));
890
898
  /*
@@ -895,10 +903,10 @@ export const socialMethods: Record<string, any> = {
895
903
  */
896
904
  const legs = meetCity
897
905
  ? [
898
- { km: Math.round(distanceKm(here, meetCity)), crossBorder: here.country !== meetCity.country },
899
- { km: Math.round(distanceKm(meetCity, c)), crossBorder: meetCity.country !== c.country },
906
+ { from: here, to: meetCity, km: Math.round(distanceKm(here, meetCity)), crossBorder: here.country !== meetCity.country },
907
+ { from: meetCity, to: c, km: Math.round(distanceKm(meetCity, c)), crossBorder: meetCity.country !== c.country },
900
908
  ]
901
- : [{ km: Math.round(distanceKm(here, c)), crossBorder: here.country !== c.country }];
909
+ : [{ from: here, to: c, km: Math.round(distanceKm(here, c)), crossBorder: here.country !== c.country }];
902
910
  const trip = this.pledgeAffordable(legs, d, c);
903
911
  if (!trip.ok) {
904
912
  return {
@@ -1215,10 +1223,10 @@ export const socialMethods: Record<string, any> = {
1215
1223
  */
1216
1224
  const legs = useMeet
1217
1225
  ? [
1218
- { km: Math.round(distanceKm(here, useMeet)), crossBorder: here.country !== useMeet.country },
1219
- { km: Math.round(distanceKm(useMeet, dest)), crossBorder: useMeet.country !== dest.country },
1226
+ { from: here, to: useMeet, km: Math.round(distanceKm(here, useMeet)), crossBorder: here.country !== useMeet.country },
1227
+ { from: useMeet, to: dest, km: Math.round(distanceKm(useMeet, dest)), crossBorder: useMeet.country !== dest.country },
1220
1228
  ]
1221
- : [{ km, crossBorder: here.country !== firstStop.country }];
1229
+ : [{ from: here, to: firstStop, km, crossBorder: here.country !== firstStop.country }];
1222
1230
  const trip = this.pledgeAffordable(legs, one.days, dest);
1223
1231
  if (!trip.ok) {
1224
1232
  return {
@@ -1292,7 +1300,7 @@ export const socialMethods: Record<string, any> = {
1292
1300
  * 她已经往家走了,接了也兑现不了 —— 那才是真的「答应了做不到」。
1293
1301
  */
1294
1302
  if (this.st.returning) {
1295
- return { text: '她已经在往回走了,这时候接不了新的约 —— 先到家再说。' };
1303
+ return { text: '她已经在往回走了,这时候接不了新的约 —— 先到家再说。', isError: true };
1296
1304
  }
1297
1305
  const r = await acceptInvite(meet, id);
1298
1306
  if (!r.ok) return { text: `没接成:${r.reason}。`, isError: true };
@@ -1405,7 +1413,9 @@ export const socialMethods: Record<string, any> = {
1405
1413
  : reopen === 'at-hour'
1406
1414
  // 八点前接的。那天还没判过 —— 说「明天才走」同样是假话。
1407
1415
  ? '\n(今天八点那个点会判走不走,到时候多半就直接动身了。别把时间说死。)'
1408
- : '\n(今天这一趟不安排动身了:这会儿太晚,或者她在睡。别跟他说「这就走」。)')
1416
+ : reopen === 'here'
1417
+ ? ''
1418
+ : '\n(今天这一趟不安排动身了:这会儿太晚,或者她在睡。别跟他说「这就走」。)')
1409
1419
  + '这件事该跟他说一句 —— 说清跟谁、先去哪儿碰头、去哪儿、几天,别当成通知念。',
1410
1420
  };
1411
1421
  },
@@ -1087,7 +1087,8 @@ export const webUiMethods: Record<string, any> = {
1087
1087
  social: (() => {
1088
1088
  const p = this.activePledge(now);
1089
1089
  const configured = String(this.cfg.meetUrl ?? '').trim() !== '';
1090
- const nearby = this.plan?.neighbors.length ?? this.nearbyProbe?.n ?? 0;
1090
+ const probed = this.nearbyProbe?.cityId === this.st.hereId ? this.nearbyProbe : null;
1091
+ const nearby = this.plan?.neighbors.length ?? probed?.n ?? 0;
1091
1092
  /*
1092
1093
  * 今天这座城来过几只**别人**(2026-11-20)。
1093
1094
  *
@@ -1102,9 +1103,7 @@ export const webUiMethods: Record<string, any> = {
1102
1103
  *
1103
1104
  * 两个都同城同日才减一;其余情况原样报。
1104
1105
  */
1105
- const probed = this.nearbyProbe;
1106
1106
  const ownCounted = !!probed
1107
- && probed.cityId === this.st.hereId
1108
1107
  && this.presenceReported?.cityId === probed.cityId
1109
1108
  && this.presenceReported?.day === probed.day;
1110
1109
  const hereToday = Math.max(0, (probed?.here ?? 0) - (ownCounted ? 1 : 0));
package/src/world.ts CHANGED
@@ -2776,10 +2776,16 @@ export class JourneyWorld implements World {
2776
2776
  * - `at-hour`:今天的决策点还没到(当地 8 点前),那一拍自己会读到
2777
2777
  * - `later`:太晚、在睡、或者本来就在那座城 —— 今天不安排动身
2778
2778
  */
2779
- private reopenTodayDecision(now: Date): 'reopened' | 'at-hour' | 'later' {
2779
+ private reopenTodayDecision(now: Date): 'reopened' | 'at-hour' | 'here' | 'later' {
2780
2780
  if (this.st.phase !== 'staying') return 'later';
2781
2781
  const here = this.cityOrNull(this.st.hereId);
2782
2782
  if (!here) return 'later';
2783
+ /* 约定的下一站就是脚下这座城(或就在会合城等人)—— 本来就在,不用赶车。 */
2784
+ const pledge = this.activePledge(now);
2785
+ if (pledge && (this.pledgeStop(pledge) === here.id
2786
+ || (pledge.meetCityId && !pledge.arrivedAt && pledge.meetArrivedAt && here.id === pledge.meetCityId))) {
2787
+ return 'here';
2788
+ }
2783
2789
  const moment = localMoment(now, here.tz);
2784
2790
  /*
2785
2791
  * 21 点之后不重开。`depart` 本身有 7–21 这个窗口,`moveOn` 却没有 ——
@@ -2787,15 +2793,13 @@ export class JourneyWorld implements World {
2787
2793
  */
2788
2794
  if (moment.decimal >= 21) return 'later';
2789
2795
  if (this.asleepUntil() > this.realNow().getTime()) return 'later';
2790
- /* 约定的下一站就是脚下这座城 —— 她本来就在,没有什么可动身的。 */
2791
- const pledge = this.activePledge(now);
2792
- if (pledge && this.pledgeStop(pledge) === here.id) return 'later';
2793
2796
  /*
2794
2797
  * 今天的决策点还没到(当地八点前):不用清,那一拍自己会读到 pledge。
2795
2798
  * **但也不能说「今天不动身」** —— 那是另一句错话。
2796
2799
  */
2797
2800
  if (moment.decimal < DECIDE_HOUR) return 'at-hour';
2798
- if (this.st.decidedOn !== moment.dateKey) return 'at-hour';
2801
+ /* 八点已过且今天还没判过:下一拍会立刻进决策并动身,语义等同 reopened。 */
2802
+ if (this.st.decidedOn !== moment.dateKey) return 'reopened';
2799
2803
 
2800
2804
  this.st = { ...this.st, decidedOn: null };
2801
2805
  this.persist();