sophhub 0.4.11 → 0.4.12
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,12 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flight-booking",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"types": [
|
|
5
5
|
"builtin"
|
|
6
6
|
],
|
|
7
7
|
"displayName": "国内机票预定",
|
|
8
|
-
"description": "",
|
|
8
|
+
"description": "国内机票查询、下单、出票、退票、改签全流程 skill",
|
|
9
9
|
"changelog": [
|
|
10
|
+
{
|
|
11
|
+
"changes": [
|
|
12
|
+
"search 取消前 15 条截断,返回当日全部航班并在表格末尾新增汇总行",
|
|
13
|
+
"list_flights_simple 默认 top_n 由 15 改为 None(返回全部)",
|
|
14
|
+
"SKILL.md 强化指引:严禁截断或只展示前 N 条航班,须逐条全部列出"
|
|
15
|
+
],
|
|
16
|
+
"date": "2026-05-09",
|
|
17
|
+
"version": "1.2.0"
|
|
18
|
+
},
|
|
10
19
|
{
|
|
11
20
|
"changes": [
|
|
12
21
|
"修正票务网关基址为 https://www.sophnet.com/api,避免请求落到 /v1/api 导致 405 或非 JSON 响应"
|
|
@@ -23,5 +32,5 @@
|
|
|
23
32
|
}
|
|
24
33
|
],
|
|
25
34
|
"createdAt": "2026-04-09",
|
|
26
|
-
"updatedAt": "2026-
|
|
35
|
+
"updatedAt": "2026-05-09"
|
|
27
36
|
}
|
|
@@ -16,13 +16,13 @@ description: "中国国内机票查询与预订。当用户需要查航班、买
|
|
|
16
16
|
- **出票前务必再次确认**:**不得在创建订单后自动连续执行出票**。第二步创建订单完成后,应先向用户展示订单号、航程与金额,**在用户明确表示「确认出票」或「去支付/出票」后再执行第三步 pay-issue**;未得到用户确认前,不要主动执行出票。
|
|
17
17
|
- **退票前务必二次确认**:**绝对不得在用户未明确确认的情况下执行退票。** 退票流程必须分两步:第一步用 `--dry-run` 查询并向用户展示退改签规则和手续费,第二步**必须等用户明确说「确认退票」「退吧」等确认性语句后**才执行实际退票命令。即使用户说了「我想退票」「帮我看看退票」,也只能先执行 dry-run 展示规则,**不得直接执行退票**。
|
|
18
18
|
- **用户必填变量**:仅需通过**环境变量**配置乘机人 `name`、`mobile`、`credentialNo`、`gender`。联系人默认与乘机人一致,无需重复设置。
|
|
19
|
-
-
|
|
19
|
+
- **航班查询结果展示须完整**:向用户展示航班列表时,**必须展示脚本返回的全部航班,不得截断、不得只展示前 N 条、不得"为节省篇幅"省略任何一条**。脚本已不再做条数限制,返回多少条就展示多少条(即使有几十条也必须全部列出)。每条须包含航班号、航空公司、出发/到达机场、**起飞时间**、**到达时间**(两列分开)、**经济舱价格与公务舱价格**、**机建费**、**燃油费**,不得漏列(无公务舱时显示「—」)。
|
|
20
20
|
|
|
21
21
|
## 流程概览
|
|
22
22
|
|
|
23
23
|
| 步骤 | 说明 | 脚本子命令 |
|
|
24
24
|
|------|------|------------|
|
|
25
|
-
| 第一步 |
|
|
25
|
+
| 第一步 | 航班查询,按经济舱价格排序并**展示全部**航班(每航班一行,含经济舱/公务舱最低价;不截断) | `search` |
|
|
26
26
|
| 第二步 | 创建订单:可选舱位报价查询 → 验舱验价 → 创建订单(常规) | `create-order` |
|
|
27
27
|
| 第三步 | 支付前校验 + 申请出票 | `pay-issue` |
|
|
28
28
|
| 附加 | 查询订单状态/详情 | `order-status` |
|
|
@@ -48,13 +48,13 @@ python3 {baseDir}/scripts/flight_booking.py search --from-city 杭州 --to-city
|
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
- 支持的城市名示例:杭州、北京、上海、广州、深圳、成都、西安、重庆、南京、武汉、青岛、厦门、昆明、海口、三亚等;也可直接填三字码(如 HGH、BJS、PVG)。若用户只说「杭州到北京」,可直接用城市名执行。
|
|
51
|
-
-
|
|
51
|
+
- **输出**:表格列为「航班号、航空公司、出发机场(含航站楼)、到达机场(含航站楼)、起飞时间、到达时间、经济舱、公务舱、机建费、燃油费」;起飞时间与到达时间为**两列**分别展示,按经济舱价格排序,**返回当日全部航班,不做条数截断**。航站楼信息拼在机场名后(如"萧山机场T3")。机建费和燃油费为每张票的附加税费。
|
|
52
52
|
- **状态保存**:查询成功后会将本次结果写入 `~/.openclaw/flight-booking/.last_search.json`,供下一步创建订单时使用;用户只需选择航班号即可下单,无需再次输入出发/到达/日期。
|
|
53
53
|
- 将表格展示给用户后,由用户选择要预订的**航班号**(及可选舱位:经济舱 Y / 公务舱 C,默认 Y)。
|
|
54
54
|
|
|
55
55
|
**航班查询结果向用户展示时,请务必做到信息完整、条数完整:**
|
|
56
56
|
|
|
57
|
-
-
|
|
57
|
+
- **条数(重点强调)**:脚本返回多少条就展示多少条,**严禁只展示前 15 条 / 前 N 条 / 部分条数**,也不得以"航班较多,仅展示部分"等理由省略。即使返回 30+ 条也必须**逐条全部列出**,由用户自行选择。
|
|
58
58
|
- **每条航班必须包含的字段**:航班号、航空公司、出发机场(含航站楼)、到达机场(含航站楼)、**起飞时间**、**到达时间**、**经济舱价格**、**公务舱价格**、**机建费**、**燃油费**。起飞时间与到达时间为**两列**,缺一不可;若某航班无公务舱则显示「—」或「无」,不得省略该列。
|
|
59
59
|
- **时间**:脚本输出为「起飞时间」「到达时间」两列,向用户展示时也须保留这两列,**不得用 ? 或空白代替到达时间**;若数据中有 `toTime` 必须原样展示。
|
|
60
60
|
- **价格**:经济舱、公务舱两列都要展示;无该舱位时用「—」表示,不得整列不显示。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
|
|
3
|
+
机票查询与下单脚本:支持航班查询(返回全部航班,不截断)、创建订单、支付校验与出票、订单状态查询、取消订单、退票。
|
|
4
4
|
乘机人信息从环境变量读取,用户需提前配置。
|
|
5
5
|
"""
|
|
6
6
|
|
|
@@ -155,8 +155,9 @@ def _extract_hhmm(time_str: str) -> str:
|
|
|
155
155
|
return s[:5] if len(s) >= 5 else s
|
|
156
156
|
|
|
157
157
|
|
|
158
|
-
def list_flights_simple(result: dict, top_n: int =
|
|
159
|
-
"""
|
|
158
|
+
def list_flights_simple(result: dict, top_n: int | None = None) -> list[dict]:
|
|
159
|
+
"""提取航班列表,每航班一行含经济舱/公务舱最低价、机建燃油费,按经济舱价格排序。
|
|
160
|
+
top_n=None 时返回全部航班(默认),不做条数截断。"""
|
|
160
161
|
if result.get("code") != "0":
|
|
161
162
|
return []
|
|
162
163
|
data = result.get("data", {})
|
|
@@ -192,6 +193,8 @@ def list_flights_simple(result: dict, top_n: int = 15) -> list[dict]:
|
|
|
192
193
|
"fuelTax": f.get("fuelTax", 0),
|
|
193
194
|
})
|
|
194
195
|
out.sort(key=lambda r: (r.get("economyPrice") is None, r.get("economyPrice") or 0))
|
|
196
|
+
if top_n is None:
|
|
197
|
+
return out
|
|
195
198
|
return out[:top_n]
|
|
196
199
|
|
|
197
200
|
|
|
@@ -726,9 +729,10 @@ def cmd_search(args: argparse.Namespace) -> int:
|
|
|
726
729
|
json.dump(state, f, ensure_ascii=False, indent=2)
|
|
727
730
|
except OSError:
|
|
728
731
|
pass # 忽略写入失败,仅影响后续 create-order 需传全参
|
|
729
|
-
rows = list_flights_simple(res, top_n=
|
|
732
|
+
rows = list_flights_simple(res, top_n=None)
|
|
730
733
|
_print_flights_table(rows)
|
|
731
734
|
print()
|
|
735
|
+
print(f"共 {len(rows)} 条航班(已按经济舱价格升序展示全部,未截断)。")
|
|
732
736
|
print("已保存最近一次查询结果。下单请使用: create-order --flight-no <航班号> [--cabin-grade Y|C]")
|
|
733
737
|
return 0
|
|
734
738
|
|
|
@@ -1166,7 +1170,7 @@ def main() -> int:
|
|
|
1166
1170
|
sub = parser.add_subparsers(dest="command", required=True)
|
|
1167
1171
|
|
|
1168
1172
|
# search:支持三字码或城市名(如 杭州、北京)
|
|
1169
|
-
p_search = sub.add_parser("search", help="
|
|
1173
|
+
p_search = sub.add_parser("search", help="航班查询,返回当日全部航班(按经济舱价格排序,不截断)")
|
|
1170
1174
|
p_search.add_argument("--from-city", required=True, help="出发城市:三字码(如 HGH)或城市名(如 杭州)")
|
|
1171
1175
|
p_search.add_argument("--to-city", required=True, help="到达城市:三字码(如 BJS)或城市名(如 北京)")
|
|
1172
1176
|
p_search.add_argument("--from-date", required=True, help="出发日期 YYYY-MM-DD")
|